summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/onionshare_cli/resources/templates/send.html4
-rw-r--r--cli/onionshare_cli/web/share_mode.py5
-rw-r--r--desktop/tests/gui_base_test.py18
-rw-r--r--desktop/tests/test_gui_share.py2
4 files changed, 22 insertions, 7 deletions
diff --git a/cli/onionshare_cli/resources/templates/send.html b/cli/onionshare_cli/resources/templates/send.html
index bd9bd631..5fc1ba1f 100644
--- a/cli/onionshare_cli/resources/templates/send.html
+++ b/cli/onionshare_cli/resources/templates/send.html
@@ -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 %}
diff --git a/cli/onionshare_cli/web/share_mode.py b/cli/onionshare_cli/web/share_mode.py
index 8ac4055e..92a4c9af 100644
--- a/cli/onionshare_cli/web/share_mode.py
+++ b/cli/onionshare_cli/web/share_mode.py
@@ -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)
diff --git a/desktop/tests/gui_base_test.py b/desktop/tests/gui_base_test.py
index 83ad5fa3..ea95eef7 100644
--- a/desktop/tests/gui_base_test.py
+++ b/desktop/tests/gui_base_test.py
@@ -285,7 +285,25 @@ class GuiBaseTest(unittest.TestCase):
def private_key_shown(self, tab):
"""Test that the Private Key is showing when not in public mode"""
if not tab.settings.get("general", "public"):
+ # Both the private key field and the toggle button should be seen
self.assertTrue(tab.get_mode().server_status.private_key.isVisible())
+ self.assertTrue(tab.get_mode().server_status.client_auth_toggle_button.isVisible())
+ self.assertEqual(tab.get_mode().server_status.client_auth_toggle_button.text(), strings._("gui_reveal"))
+
+ # Test that the key is masked unless Reveal is clicked
+ self.assertEqual(tab.get_mode().server_status.private_key.text(), "*" * len(tab.app.auth_string))
+
+ # Click reveal
+ tab.get_mode().server_status.client_auth_toggle_button.click()
+
+ # The real private key should be revealed
+ self.assertEqual(tab.get_mode().server_status.private_key.text(), tab.app.auth_string)
+ self.assertEqual(tab.get_mode().server_status.client_auth_toggle_button.text(), strings._("gui_hide"))
+
+ # Click hide, key should be masked again
+ tab.get_mode().server_status.client_auth_toggle_button.click()
+ self.assertEqual(tab.get_mode().server_status.private_key.text(), "*" * len(tab.app.auth_string))
+ self.assertEqual(tab.get_mode().server_status.client_auth_toggle_button.text(), strings._("gui_reveal"))
else:
self.assertFalse(tab.get_mode().server_status.private_key.isVisible())
diff --git a/desktop/tests/test_gui_share.py b/desktop/tests/test_gui_share.py
index d3536569..2cc48d17 100644
--- a/desktop/tests/test_gui_share.py
+++ b/desktop/tests/test_gui_share.py
@@ -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)