Describe the bug
When uploading an eBook with non-ASCII characters (e.g., Chinese characters or full-width punctuation like :) via the Web UI upload button, the file extension is incorrectly stripped/replaced during the filename sanitization process (e.g., .epub becomes _epub without the leading dot).
As a result, the downstream ingest-processor fails to identify the file format, throws an is currently unsupported / is not a known ebook format error, and silently drops the file.
To Reproduce
Prepare an EPUB/MOBI file with non-ASCII or Chinese characters in its filename (e.g., 测试书籍_副标题.epub).
Upload the file via the Web UI.
The upload appears to complete in the UI, but the book never appears in the library.
Check the container logs to see the ingest processor failing due to missing file extensions.
Expected behavior
The filename sanitization logic should preserve the original file extension (e.g., split via os.path.splitext first to keep .epub/.mobi intact) even when the base filename contains non-ASCII characters.
Screenshots / Logs (Sanitized)
Plaintext
[INFO] [cps.editbooks] Upload request received: user_agent=... content_length=... file_fields=['btn-upload', 'btn-upload2']
[cwa-ingest-service] New file detected - /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub - Starting Ingest Processor...
[ingest-processor] GDrive functionality available
[ingest-processor] Auto-send and metadata functionality available
[ingest-processor] Lock acquired successfully
[ingest-processor] Checking if file is ready: new_1_XXXXXXXX_XXXXXX_XXXXXX_epub
[ingest-processor]: Cannot convert /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub. is currently unsupported / is not a known ebook format.
[ingest-processor] Lock released
[cwa-ingest-service] Successfully processed: /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub
Note: Notice how /cwa-book-ingest/new_1_..._epub has an underscore _epub instead of .epub, leading to empty format detection in ingest-processor.
Workaround verified
Renaming the exact same file to pure ASCII characters (e.g., testbook.epub) and uploading it through the Web UI succeeds, and Calibre-Web correctly extracts the internal Chinese metadata and cover.
Environment:
OS: Linux (Docker)
Deployment: Calibre-Web Automated (CWA)
Describe the bug
When uploading an eBook with non-ASCII characters (e.g., Chinese characters or full-width punctuation like :) via the Web UI upload button, the file extension is incorrectly stripped/replaced during the filename sanitization process (e.g., .epub becomes _epub without the leading dot).
As a result, the downstream ingest-processor fails to identify the file format, throws an is currently unsupported / is not a known ebook format error, and silently drops the file.
To Reproduce
Prepare an EPUB/MOBI file with non-ASCII or Chinese characters in its filename (e.g., 测试书籍_副标题.epub).
Upload the file via the Web UI.
The upload appears to complete in the UI, but the book never appears in the library.
Check the container logs to see the ingest processor failing due to missing file extensions.
Expected behavior
The filename sanitization logic should preserve the original file extension (e.g., split via os.path.splitext first to keep .epub/.mobi intact) even when the base filename contains non-ASCII characters.
Screenshots / Logs (Sanitized)
Plaintext
[INFO] [cps.editbooks] Upload request received: user_agent=... content_length=... file_fields=['btn-upload', 'btn-upload2']
[cwa-ingest-service] New file detected - /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub - Starting Ingest Processor...
[ingest-processor] GDrive functionality available
[ingest-processor] Auto-send and metadata functionality available
[ingest-processor] Lock acquired successfully
[ingest-processor] Checking if file is ready: new_1_XXXXXXXX_XXXXXX_XXXXXX_epub
[ingest-processor]: Cannot convert /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub. is currently unsupported / is not a known ebook format.
[ingest-processor] Lock released
[cwa-ingest-service] Successfully processed: /cwa-book-ingest/new_1_XXXXXXXX_XXXXXX_XXXXXX_epub
Note: Notice how /cwa-book-ingest/new_1_..._epub has an underscore _epub instead of .epub, leading to empty format detection in ingest-processor.
Workaround verified
Renaming the exact same file to pure ASCII characters (e.g., testbook.epub) and uploading it through the Web UI succeeds, and Calibre-Web correctly extracts the internal Chinese metadata and cover.
Environment:
OS: Linux (Docker)
Deployment: Calibre-Web Automated (CWA)