Encode before copy metadata. fix #2832

This commit is contained in:
Ruud committed 2014-02-16 14:19:15 +01:00
1 parent 30f5a3944c
commit f50c8504cf
2 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -110,7 +110,7 @@ class Plugin(object):
f.write(content) f.write(content)
f.close() f.close()
os.chmod(path, Env.getPermission('file')) os.chmod(path, Env.getPermission('file'))
except Exception as e: except:
log.error('Unable writing to file "%s": %s', (path, traceback.format_exc())) log.error('Unable writing to file "%s": %s', (path, traceback.format_exc()))
if os.path.isfile(path): if os.path.isfile(path):
os.remove(path) os.remove(path)
+5 -1
View File
@@ -1,4 +1,5 @@
from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import sp
from couchpotato.core.helpers.variable import mergeDicts from couchpotato.core.helpers.variable import mergeDicts
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin from couchpotato.core.plugins.base import Plugin
@@ -48,6 +49,9 @@ class MetaDataBase(Plugin):
if content: if content:
log.debug('Creating %s file: %s', (file_type, name)) log.debug('Creating %s file: %s', (file_type, name))
if os.path.isfile(content): if os.path.isfile(content):
content = sp(content)
name = sp(name)
shutil.copy2(content, name) shutil.copy2(content, name)
shutil.copyfile(content, name) shutil.copyfile(content, name)
@@ -59,7 +63,7 @@ class MetaDataBase(Plugin):
group['renamed_files'].append(name) group['renamed_files'].append(name)
try: try:
os.chmod(name, Env.getPermission('file')) os.chmod(sp(name), Env.getPermission('file'))
except: except:
log.debug('Failed setting permissions for %s: %s', (name, traceback.format_exc())) log.debug('Failed setting permissions for %s: %s', (name, traceback.format_exc()))