theslavicbear / Ebook-Publisher

A Python tool for converting online stories into portable formats
MIT License
35 stars 2 forks source link

Filenames contain forbidden characters in Windows, and won't write #85

Closed goosebumpsrus closed 1 year ago

goosebumpsrus commented 2 years ago

Thanks for developing this wonderful tool, but on Windows I'm having trouble downloading stories containing a " (double quote) or ? (question mark) in their title.

I'm assuming this would also be applicable to stories with an * (asterisk), < (less than) or > (greater than) character, as these are forbidden in Windows file names.

Error reads: OSError: [Errno 22] Invalid argument: '[directory]\[storyname].html'

Additionally, when trying stories with a : (colon) in the title, rather than give an error on writing, the file seems to stop writing prematurely at the colon. This results in a file of 0kb with a file name of the title up to the colon, and no extension.

(eg. Master PC: Jenny's Tale becomes Master PC, rather than Master PC: Jenny's Tale.html)

Thanks.

Example stories:

"Yes" - https://chyoa.com/chapter/Introduction.37982 Master PC: Jenny's Tale - https://chyoa.com/chapter/Introduction.176462 Party Time? - https://chyoa.com/chapter/Introduction.259702

theslavicbear commented 1 year ago

Interesting. Using the windows linux subsystem to run this automatically replaces invalid filename characters with  but powershell does not.

theslavicbear commented 1 year ago

fixed in latest