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

Download URL incorrect if we need to authorize #55

Open
bittylicious opened this issue Oct 24, 2020 · 1 comment
Open

Download URL incorrect if we need to authorize #55

bittylicious opened this issue Oct 24, 2020 · 1 comment

Comments

@bittylicious
Copy link

bittylicious commented Oct 24, 2020

When trying to download a B2 file using the Client::download function, I've noticed that we can overwrite the hostname we're connecting to, leaving just the path.

cURL will then correctly complain that an invalid URL is given. That's because we're asking for /b2api/v1/b2_download_file_by_id?whatever instead of https://xxxx.backblazeb2.com/b2api/v1/b2_download_file_by_id?whatever

I think that I only see this because I'm passing in an invalid token, but I think the bug is still valid.

To fix this, I think we need to change src/Client.php's download function and move $this->authorizeAccount() above the if (isset($options['FileId'])) and $requestOptions = [ ... ] blocks. authorizeAccount can set the class's downloadUrl and authToken variables, and we're relying on these in this function.

@mlambley
Copy link
Member

Hi @bittylicious would #61 solve this problem? It sets the download url properly by calling authorizeAccount first.

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

2 participants