-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
What happened ?
During downloading (covers), the process crashed due to a too long filename.
Which came… unexpectedly :)
Logs:
Details
[INFO] Getting manga id from cover url
[INFO] Finding matching cover from filename
[INFO] Found Volume 4 cover from 'MANGA_NAME', downloading...
Traceback (most recent call last):
File "/usr/lib/python3.13/pathlib/_local.py", line 722, in mkdir
os.mkdir(self, mode)
~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 36] File name too long: 'FILENAME_THAT_IS_1250_characters_LONG'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "path_to_install/mangadex_downloader/cli/init.py", line 104, in _main
download(args)
~~~~~~~~^^^^^^
File "path_to_install/mangadex_downloader/cli/download.py", line 34, in download
url(args, args.type)
~~~^^^^^^^^^^^^^^^^^
File "path_to_install/mangadex_downloader/cli/url.py", line 199, in call
self.func(self.id, args)
~~~~~~~~~^^^^^^^^^^^^^^^
File "path_to_install/mangadex_downloader/cli/url.py", line 176, in download_cover
dl_cover_art(url, args.replace)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "path_to_install/mangadex_downloader/main.py", line 359, in download_cover_art_manga
base_path = create_directory("", path=get_path(manga))
File "path_to_install/mangadex_downloader/utils.py", line 81, in create_directory
base_path.mkdir(parents=True, exist_ok=True)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/pathlib/_local.py", line 731, in mkdir
if not exist_ok or not self.is_dir():
~~~~~~~~~~~^^
File "/usr/lib/python3.13/pathlib/_abc.py", line 465, in is_dir
return S_ISDIR(self.stat(follow_symlinks=follow_symlinks).st_mode)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/pathlib/_local.py", line 515, in stat
return os.stat(self, follow_symlinks=follow_symlinks)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 36] File name too long: 'FILENAME_THAT_IS_1250_characters_LONG'
[INFO] Cleaning up...
- IFS=
What did you expect to happen ?
No crash, I suppose?
What should happen in the future?
The following placeholders can get very large:
- manga.artists,
- manga.authors,
- manga.alternative_titles
- manga.description
- (maybe?) manga.tags
To prevent too long filenames, these cases should be handled gracefully (not plain cutting at the end).
Some possibilities:
- Trimming of Authors to for example "Various Autors/Artists" at certain length.
- Checking for duplicates between Authors and Artist to merge them into one field? (Would require some sort of fallback placeholder)
- Description shortening (may end with
…
— one character btw.) - Alternative Titles shortening
And a general fallback catching the error and either just reporting it, or gracefully cutting placeholders by ranking.
The ranking should probably be user-defined, as everyone deems different things most important.
OS version
Linux x64
App version
mangadex-downloader v3.1.4 (installed via pipx)
Python: 3.13.X
arch: x64
bundled executable: no
Installation origin
PyPI (Python Package Index)
Reproducible command
config.path
needs to exceed the Filesystem limit (255 Bytes for ext4)
I, apparently, stumbled across a work with a LOT of authors and artists :D
For testing, you can probably manually write a bunch of text into the path config and guarantee exceeding the limit.
Additional context
Please note, that for Filesystems the Byte-Length, not Characters-Number, can be relevant. And with Manga, non-Latin Characters such as Japanese can fill that limit quicker.
Details
Here are some filename length limits in popular file systems:
BTRFS 255 bytes
exFAT 255 UTF-16 characters
ext2 255 bytes
ext3 255 bytes
ext3cow 255 bytes
ext4 255 bytes
FAT32 8.3 (255 UCS-2 code units with VFAT LFNs)
NTFS 255 characters
XFS 255 bytes
PS: I tried to find a quick fix, but couldn't determine a code point in your dynamic code to just replace the authors in the folder/filename, if they exceed a limit.
Either, I'd need more time, or more than just a line or two needs to change for that.
Of course, without actually removing the meta data entirely, as they can still be printed into the metadata files etc..
Kind regards :)