1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-28 03:10:45 +00:00

Merge pull request #4908 from haiwen/share-link-dl

fix bug when visit password protected direct download share link
This commit is contained in:
Daniel Pan 2021-05-28 11:48:07 +08:00 committed by GitHub
commit 2175c1234b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -5,9 +5,17 @@
<div class="mt-9 mb-4 mx-auto small-panel">
<p class="intro">{% trans "Please input the password if you want to browse the shared file/directory." %}</p>
{% if path %}
{% if direct_download %}
<form action="{% url view_name token %}?p={{ path }}&dl=1" method="post" id="share-passwd-form">
{% else %}
<form action="{% url view_name token %}?p={{ path }}" method="post" id="share-passwd-form">
{% endif %}
{% else %}
{% if direct_download %}
<form action="{% url view_name token %}?dl=1" method="post" id="share-passwd-form">
{% else %}
<form action="{% url view_name token %}" method="post" id="share-passwd-form">
{% endif %}
{% endif %}
{% csrf_token %}
<input type="hidden" name="token" value="{{ token }}" />

View File

@ -1109,8 +1109,10 @@ def view_shared_file(request, fileshare):
# check if share link is encrypted
password_check_passed, err_msg = check_share_link_common(request, fileshare)
direct_download = request.GET.get('dl', '') == '1'
if not password_check_passed:
d = {'token': token, 'view_name': 'view_shared_file', 'err_msg': err_msg}
d = {'token': token, 'view_name': 'view_shared_file',
'err_msg': err_msg, 'direct_download': direct_download}
return render(request, 'share_access_validation.html', d)
# recourse check