Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle bad file type? #379

Open
eight04 opened this issue May 11, 2024 · 0 comments
Open

Handle bad file type? #379

eight04 opened this issue May 11, 2024 · 0 comments

Comments

@eight04
Copy link
Owner

eight04 commented May 11, 2024

If there is a bad file type error, Comic Crawler goes into a 416 error loop:

  1. Download file into foo.part.
  2. Sniff file extension.
  3. Bad file type error.
  4. Retry, send range request.
  5. HTTP 416.

Do we want to delete .part file?

The file is downloaded completely. The content is valid. The extension is also valid in this case. There's a bug in puremagic that reports the wrong extension.

Do we want to delete .part file on HTTP 416 error?

Probably no? The most common case of 416 is that a link is expired and we have to fetch the link again.

The main issue

There shouldn't be any .part file if the download is completed. Post processing should happen after renaming the file. So the process should be:

  1. Download file into foo.part
  2. Sniff file extension.
  3. Rename to foo.docx
  4. Bad file type error.
  5. Delete the file (?).
  6. Retry download.

But then it introduces a re-download loop.

Remove bad file type error?

It is used to detect URL redirection leading to an HTML page. It also provides an extension whitelist.

Maybe we can use a blacklist instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant