summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2018-02-24 18:38:40 -0800
committerMicah Lee <micah@micahflee.com>2018-02-24 18:38:40 -0800
commit3797e9e2039bbc0109222cd94e32557938ca8dad (patch)
treecc7b84dce2d5ec1caf961f5f14eb0488489e45cd
parentf41ad976ea081d132e49c7ea946eb87b975de16e (diff)
downloadonionshare-3797e9e2039bbc0109222cd94e32557938ca8dad.tar.gz
onionshare-3797e9e2039bbc0109222cd94e32557938ca8dad.zip
When using <img>, put the src in quotes. Otherwise the filename is likely to have spaces in it, and the <img> src will break. Also, in Windows use backslashes for local resources instead of forward slashes
-rw-r--r--onionshare/common.py6
-rw-r--r--onionshare_gui/onionshare_gui.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/onionshare/common.py b/onionshare/common.py
index 79d62ca9..9703e0f5 100644
--- a/onionshare/common.py
+++ b/onionshare/common.py
@@ -57,7 +57,7 @@ def get_platform():
"""
Returns the platform OnionShare is running on.
"""
- plat = platform.system()
+ plat = platform.system()
if re.match('^.*BSD$', plat):
plat = 'BSD'
return plat
@@ -69,6 +69,10 @@ def get_resource_path(filename):
"""
p = get_platform()
+ # On Windows, and in Windows dev mode, switch slashes in incoming filename to backslackes
+ if p == 'Windows':
+ filename = filename.replace('/', '\\')
+
if getattr(sys, 'onionshare_dev_mode', False):
# Look for resources directory relative to python file
prefix = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'share')
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 56a1967b..5c05ae18 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -684,7 +684,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_completed_downloads_image = common.get_resource_path('images/download_completed_none.png')
else:
self.info_completed_downloads_image = common.get_resource_path('images/download_completed.png')
- self.info_completed_downloads_count.setText('<img src={0:s} /> {1:d}'.format(self.info_completed_downloads_image, count))
+ self.info_completed_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(self.info_completed_downloads_image, count))
self.info_completed_downloads_count.setToolTip(strings._('info_completed_downloads_tooltip', True).format(count))
def update_downloads_in_progress(self, count):
@@ -695,7 +695,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress_none.png')
else:
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress.png')
- self.info_in_progress_downloads_count.setText('<img src={0:s} /> {1:d}'.format(self.info_in_progress_downloads_image, count))
+ self.info_in_progress_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(self.info_in_progress_downloads_image, count))
self.info_in_progress_downloads_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(count))
def closeEvent(self, e):