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

Sharing with password and default path broken #4440

Closed
yuyichao opened this issue Feb 14, 2020 · 1 comment
Closed

Sharing with password and default path broken #4440

yuyichao opened this issue Feb 14, 2020 · 1 comment

Comments

@yuyichao
Copy link

This seems to be broken by 44459bb templates/share_access_validation.html stops checking whether path is empty and always append a p= parameter, which becomes ?p= when the path is empty.

When the request is submitted.

seahub/seahub/views/repo.py

Lines 254 to 255 in 82f16b9

req_path = request.GET.get('p', '/')
if req_path[-1] != '/':

req_path will be '' (not handled by get) since it exists, and it caused a OOB error when trying to access the last character.

I now fixed this locally by changing the request handler into

if req_path == '':
    req_path = '/'
elif req_path[-1] != '/':
    req_path += '/'

and it can probably also be fixed from the template as well. Should ?p= be supported? Sumitting a PR for this should be easy but I don't know which one is the proper fix.

P.S. Is there a way to print out the backtrace when an error happens like this? I end up throwing an error in server_error (500 handler) and got the backtrace in error.log. Is there a better way?

Tested on 7.1.1.

yuyichao added a commit to yuyichao/seahub that referenced this issue Feb 14, 2020
Avoid generating URL with empty `p` parameter and also handle it correctly when one is generated.

Fix regression caused by 44459bb

Fix haiwen#4440
yuyichao added a commit to yuyichao/seahub that referenced this issue Mar 28, 2020
Avoid generating URL with empty `p` parameter and also handle it correctly when one is generated.

Fix regression caused by 44459bb

Fix haiwen#4440
@freeplant
Copy link
Member

Fixed in #4529

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 a pull request may close this issue.

2 participants