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
Conversation
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.
frontend/src/views/Share.vue
Outdated
@@ -93,7 +93,7 @@ | |||
</a> | |||
<a | |||
target="_blank" | |||
:href="link + '?inline=true'" | |||
:href="link + '&inline=true'" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 &.
Please make sure that all checks are passing. |
You will need to squash your commits, taking into account the commintlint rules. |
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 becauseURL.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.