Merge pull request #1406 from SaptakS/fix-filelisting

Fixes directory listing in send mode
This commit is contained in:
Micah Lee 2021-09-09 16:52:25 -07:00 committed by GitHub
commit bb1b3ad157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -40,7 +40,7 @@
<div class="d-flex">
<div>
<img width="30" height="30" title="" alt="" src="{{ static_url_path }}/img/web_folder.png" />
<a href="{{ info.basename }}">
<a href="{{ info.link }}">
<span>{{ info.basename }}</span>
</a>
</div>
@ -53,7 +53,7 @@
<div>
<img width="30" height="30" title="" alt="" src="{{ static_url_path }}/img/web_file.png" />
{% if download_individual_files %}
<a href="{{ info.basename }}">
<a href="{{ info.link }}">
<span>{{ info.basename }}</span>
</a>
{% else %}

View File

@ -425,10 +425,7 @@ class ShareModeWeb(SendBaseModeWeb):
# Render directory listing
filenames = []
for filename in os.listdir(filesystem_path):
if os.path.isdir(os.path.join(filesystem_path, filename)):
filenames.append(filename + "/")
else:
filenames.append(filename)
filenames.append(filename)
filenames.sort()
return self.directory_listing(filenames, path, filesystem_path)

View File

@ -99,7 +99,7 @@ class TestShare(GuiBaseTest):
self.assertEqual(r.status_code, 404)
self.download_share(tab)
else:
self.assertTrue('a href="test.txt"' in r.text)
self.assertTrue('a href="/test.txt"' in r.text)
r = requests.get(download_file_url)
tmp_file = tempfile.NamedTemporaryFile("wb", delete=False)