From b1e66478f065d0ec9ea5b2ac4c715123340cd6e3 Mon Sep 17 00:00:00 2001 From: rbfblk Date: Mon, 30 Sep 2013 00:55:02 -0400 Subject: [PATCH] Fixing an issue which strips all read bits from utorrent downloaded files on Linux --- couchpotato/core/downloaders/utorrent/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/utorrent/main.py b/couchpotato/core/downloaders/utorrent/main.py index 18d3398..304eeaf 100644 --- a/couchpotato/core/downloaders/utorrent/main.py +++ b/couchpotato/core/downloaders/utorrent/main.py @@ -182,7 +182,9 @@ class uTorrent(Downloader): if folder and os.path.isdir(folder): for root, folders, filenames in os.walk(folder): for filename in filenames: - os.chmod(os.path.join(root, filename), stat.S_IWRITE) + filepath = os.path.join(root, filename) + #Windows only needs S_IWRITE, but we bitwise-or with current perms to preserve other permission bits on Linux + os.chmod(filepath, stat.S_IWRITE | os.stat(filepath).st_mode) class uTorrentAPI(object):