[Pkg-privacy-commits] [onionshare] 08/12: Fixed crash in Windows, related to HS directory path and slashes

Ulrike Uhlig u-guest at moszumanska.debian.org
Mon Jan 4 17:08:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch debian
in repository onionshare.

commit e60a82ad220aefd2bf126bff8ecebf9764368e95
Author: Micah Lee <micah at micahflee.com>
Date:   Mon Dec 7 23:47:13 2015 -0800

    Fixed crash in Windows, related to HS directory path and slashes
---
 onionshare/hs.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/onionshare/hs.py b/onionshare/hs.py
index 3428bfe..4857881 100644
--- a/onionshare/hs.py
+++ b/onionshare/hs.py
@@ -95,19 +95,21 @@ class HS(object):
         else:
             # come up with a hidden service directory name
             if helpers.get_platform() == 'Windows':
-                path = '{0:s}/onionshare'.format(os.environ['Temp'].replace('\\', '/'))
+                self.hidserv_dir = tempfile.mkdtemp()
+                self.hidserv_dir = self.hidserv_dir.replace('\\', '/')
+
             else:
                 path = '/tmp/onionshare'
+                try:
+                    if not os.path.exists(path):
+                        os.makedirs(path, 0700)
+                except:
+                    raise HSDirError(strings._("error_hs_dir_cannot_create").format(path))
+                if not os.access(path, os.W_OK):
+                    raise HSDirError(strings._("error_hs_dir_not_writable").format(path))
 
-            try:
-                if not os.path.exists(path):
-                    os.makedirs(path, 0700)
-            except:
-                raise HSDirError(strings._("error_hs_dir_cannot_create").format(path))
-            if not os.access(path, os.W_OK):
-                raise HSDirError(strings._("error_hs_dir_not_writable").format(path))
+                self.hidserv_dir = tempfile.mkdtemp(dir=path)
 
-            self.hidserv_dir = tempfile.mkdtemp(dir=path)
             self.cleanup_filenames.append(self.hidserv_dir)
 
             # set up hidden service

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list