Add download.umask config option with default of 077

This commit is contained in:
David Stainton 2015-12-08 03:01:19 +02:00 committed by Brian Warner
parent 623ed3516e
commit f2a7978b29
3 changed files with 6 additions and 6 deletions

View File

@ -491,8 +491,8 @@ class Client(node.Node, pollmixin.PollMixin):
dbfile = abspath_expanduser_unicode(dbfile)
from allmydata.frontends import magic_folder
s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile)
umask = self.get_config("magic_folder", "download.umask", 0077)
s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile, umask)
s.setServiceParent(self)
s.startService()

View File

@ -56,7 +56,7 @@ def is_new_file(pathinfo, db_entry):
class MagicFolder(service.MultiService):
name = 'magic-folder'
def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile,
def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, umask,
pending_delay=1.0, clock=None):
precondition_abspath(local_path_u)
@ -77,7 +77,7 @@ class MagicFolder(service.MultiService):
self.uploader = Uploader(client, local_path_u, db, upload_dirnode, pending_delay, clock, immediate)
self.downloader = Downloader(client, local_path_u, db, collective_dirnode,
upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending)
upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending, umask)
def startService(self):
# TODO: why is this being called more than once?
@ -527,7 +527,7 @@ class Downloader(QueueMixin, WriteFileMixin):
REMOTE_SCAN_INTERVAL = 3 # facilitates tests
def __init__(self, client, local_path_u, db, collective_dirnode,
upload_readonly_dircap, clock, is_upload_pending, umask = 0123):
upload_readonly_dircap, clock, is_upload_pending, umask):
QueueMixin.__init__(self, client, local_path_u, db, 'downloader', clock)
if not IDirectoryNode.providedBy(collective_dirnode):

View File

@ -1118,7 +1118,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
pass
writefile = TestWriteFileMixin()
writefile._umask = 0123
writefile._umask = 0077
# create a file with name "foobar" with content "foo"
# write downloaded file content "bar" into "foobar" with is_conflict = False