[web] fix css file generation permission bug (closes #17143773)
PropertySheet.process_resource() uses mkstemp which enforce a 0600 mode on the
output file, which is not the file permission we want for css files.
--- a/cubicweb/web/propertysheet.py Thu Apr 19 12:45:24 2018 +0200
+++ b/cubicweb/web/propertysheet.py Thu Apr 19 12:47:48 2018 +0200
@@ -109,6 +109,12 @@
with os.fdopen(tmpfd, 'w') as stream:
stream.write(content)
try:
+ mode = os.stat(sourcefile).st_mode
+ os.chmod(tmpfile, mode)
+ except IOError:
+ self.warning('Cannot set access mode for %s; you may encouter '
+ 'file permissions issues', cachefile)
+ try:
os.rename(tmpfile, cachefile)
except OSError as err:
if err.errno != errno.EEXIST: