google-books-downloader icon indicating copy to clipboard operation
google-books-downloader copied to clipboard

Invalid input

Open liukliukliuk opened this issue 3 years ago • 3 comments

image

This keeps happening even though I choose valid locations or just enter.

liukliukliuk avatar Mar 14 '21 22:03 liukliukliuk

Same problem here. I have found out that the problem occurs for books whose title contains characters that are invalid for filenames, e.g. a semicolon (which is pretty common in books with a subtitle). The path (new_directory) in step3() should be filtered taking into account the illegal characters in different filesystems (I guess NTFS is the most restrictive). Additionally, error handling might be improved by distinguishing "Bad input" errors from "filesystem errors".

isra00 avatar Mar 22 '21 08:03 isra00

i solved it like this;

def clean_path(path):
    invalid = '<>:"/\|?* '

    for char in invalid:
        path = path.replace(char, '')

    return path
      new_directory = os.path.join(main_directory, clean_path(book_data))

also in save_backup()

Eddict avatar Apr 17 '21 19:04 Eddict

@Eddict that's great! Could you make it in a pull request so that code can go to upstream? Thank you

isra00 avatar May 26 '21 19:05 isra00