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

Does not fail when dealing with a 403 http status code #119

Open
shadoWalker89 opened this issue Nov 12, 2024 · 1 comment
Open

Does not fail when dealing with a 403 http status code #119

shadoWalker89 opened this issue Nov 12, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@shadoWalker89
Copy link

Hi,

Great package,
I'm using your package to download files from google drive, and it works great except for the fact when the file i'm trying to download is not public google drive returns an 403 status code.
Despite the 403, the package does not emit the error event nor call the catch() callback

      dl.on('error', (err) => reject(err));
      dl.start().catch(err => reject(err));

Instead it's emitting the end event and passes The following downloadEndedStats

{
  fileName: '10.mp4',
  filePath: 'C:\\Users\\Melek\\AppData\\Roaming\\MyApp\\presentations\\10.mp4',
  totalSize: null,
  incomplete: false,
  onDiskSize: 873039,
  downloadedSize: 873039
}

As a workaround i'm currently within the end callback checking if the totalSize === null to know if something is wrong, but i think that if returning anything other than a 200 range or 300 range in case of redirects (if supported) this should fail

Thanks

@hgouveia hgouveia self-assigned this Nov 12, 2024
@hgouveia hgouveia added the bug Something isn't working label Nov 12, 2024
@hgouveia
Copy link
Owner

Hello @shadoWalker89 , thanks for the report,

when it receives a response we check the status and 403 should goes under error, but i think the issue is the same related with #115 and maybe #113 and is happening at the HEAD step inside the getTotalSize(), where we do a pre request to get the file size first

unfortunately i don't know when i will have the time to take a lot into this, but i will try ASAP, since there are multiple reports related,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants