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

Fix 401 error in share view open file button #1495

Merged
merged 5 commits into from Aug 19, 2021

Conversation

andrew-kennedy
Copy link
Contributor

This link would be generated with a ?token=<hash>?inline=true when it should be ?token=<hash>&inline=true. This was causing 401 Unauthorized errors because URL.Query().Get("token") would return the empty string and so authenticateShareRequest would try to verify the password in the header, which doesn't exist for these requests.

This link would be generated with a `?token=<hash>?inline=true` when it should be `?token=<hash>&inline=true`. This was causing 401 Unauthorized errors because `URL.Query().Get("token")` would return the empty string and so (authenticateShareRequest)[https://github.com/filebrowser/filebrowser/blob/dee465ab865ba5bf96fbfbe5888f4e95731d3701/http/public.go#L126] would try to verify the password in the header, which doesn't exist for these requests.
@@ -93,7 +93,7 @@
</a>
<a
target="_blank"
:href="link + '?inline=true'"
:href="link + '&inline=true'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make the link invalid on shares without password.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I really need to properly construct the query string using official builder methods.

This should avoid the pitfalls of trying to manually decide to attach inline=true with a ? or a &.
@ramiresviana
Copy link
Contributor

Please make sure that all checks are passing.

@ramiresviana
Copy link
Contributor

You will need to squash your commits, taking into account the commintlint rules.

@o1egl o1egl merged commit 25c8788 into filebrowser:master Aug 19, 2021
Alsan pushed a commit to Alsan/filebrowser that referenced this pull request Aug 25, 2021
rahul-r pushed a commit to rahul-r/filebrowser that referenced this pull request Sep 2, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants