mirror of
https://github.com/ciromattia/kcc
synced 2026-10-10 03:22:31 +00:00
fix Access is denied with read only input folder (2013 bug) (#1387)
* fix Access is denied on read only input folders * minimize changes
This commit is contained in:
@@ -1205,7 +1205,15 @@ def removeNonImages(filetree):
|
|||||||
os.rmdir(root)
|
os.rmdir(root)
|
||||||
|
|
||||||
if not os.listdir(Path(filetree).parent):
|
if not os.listdir(Path(filetree).parent):
|
||||||
raise UserWarning('No images detected, nested archives are not supported.')
|
warning = [
|
||||||
|
'No images detected.',
|
||||||
|
'',
|
||||||
|
'Possible causes:',
|
||||||
|
'',
|
||||||
|
'1) Incompatible image file extension like .jxl. Convert to .png first outside of KCC.',
|
||||||
|
'2) Nested archive: Either extract the nested archive outside of KCC or use File Fusion option.',
|
||||||
|
]
|
||||||
|
raise RuntimeError('\n'.join(warning))
|
||||||
|
|
||||||
|
|
||||||
def sanitizeTree(filetree, prefix='kcc'):
|
def sanitizeTree(filetree, prefix='kcc'):
|
||||||
@@ -1254,6 +1262,7 @@ def flattenTree(filetree):
|
|||||||
|
|
||||||
|
|
||||||
def sanitizePermissions(filetree):
|
def sanitizePermissions(filetree):
|
||||||
|
os.chmod(filetree, S_IWRITE | S_IREAD | S_IEXEC)
|
||||||
for root, dirs, files in os.walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD)
|
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD)
|
||||||
|
|||||||
Reference in New Issue
Block a user