gallery_get icon indicating copy to clipboard operation
gallery_get copied to clipboard

Reddit users with extremely long thread names throw exceptions

Open Kvasmuppet opened this issue 6 years ago • 2 comments

Possibly a windows issue. Users with extremely long thread names throw OSError: [WinError 123] for directories and OSError: [Errno 22] exceptions for files. Is there a way to disable the generation of folder names based upon thread name and simply use the image name from imgur instead of threadname.jpg ?

Note: I have noticed that you do have a section in the code limiting the characters fileName = os.path.abspath(fileNameFull)[:255] + fileExtension # full path must be 260 characters or lower

The script is trying to create a directory which is 299 characters long and a filename of 302 characters, while trying to create the same directory with explorer the most characters I could use were 226 characters. So it would appear that the dir names and filenames are not being shortened.

Obviously 299 and 302 characters are a bit...excessive.

Kvasmuppet avatar Sep 12 '18 20:09 Kvasmuppet

Sounds like we should start truncating directory names as well as filenames. Maybe truncate the directory name such that its absolute path is 200 or something (which would allow for at least a 60-character filename). Does that sound reasonable?

On Wed, Sep 12, 2018 at 1:15 PM Kvasmuppet [email protected] wrote:

Possibly a windows issue. Users with extremely long thread names throw OSError: [WinError 123] for directories and OSError: [Errno 22] exceptions for files. Is there a way to disable the generation of folder names based upon thread name and simply use the image name from imgur instead of threadname.jpg ?

Note: I have noticed that you do have a section in the code limiting the characters fileName = os.path.abspath(fileNameFull)[:255] + fileExtension # full path must be 260 characters or lower

The script is trying to create a directory which is 299 characters long and a filename of 302 characters, while trying to create the same directory with explorer the most characters I could use were 226 characters. So it would appear that the dir names and filenames are not being shortened.

Obviously 299 and 302 characters are a bit...excessive.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/regosen/gallery_get/issues/49, or mute the thread https://github.com/notifications/unsubscribe-auth/AEYHUmnxmm3Vti0liTh4ohslrAfRzVzlks5uaWtbgaJpZM4WmFv7 .

regosen avatar Sep 12 '18 20:09 regosen

Sounds reasonable. Though if given the choice , I'd prefer dirs and files being formated as [date + time] + imgur album url (eg: D5vU4) and files simply [date + time] + url filename + ext .

I have absolutely no knowledge of python, so sadly I can't offer any help. I am gradually learning now by using google on the error codes and looking at the code though.

Kvasmuppet avatar Sep 12 '18 21:09 Kvasmuppet