detecció de fitxers extranys en el fitxer
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from core.constants import TRASH_FILES
|
||||
from core.constants import TRASH_FILES, IMAGE_EXTENSIONS, FOREIGN_ALLOWED
|
||||
from core.result import StepResult
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ def clean_directory(work_dir: str) -> StepResult:
|
||||
full = os.path.join(root, f)
|
||||
os.remove(full)
|
||||
removed.append(os.path.relpath(full, work_dir))
|
||||
elif os.path.splitext(f)[1].lower() not in IMAGE_EXTENSIONS \
|
||||
and f.lower() not in FOREIGN_ALLOWED:
|
||||
full = os.path.join(root, f)
|
||||
os.remove(full)
|
||||
removed.append(os.path.relpath(full, work_dir))
|
||||
for d in dirs:
|
||||
if d.lower() in TRASH_FILES:
|
||||
full = os.path.join(root, d)
|
||||
|
||||
Reference in New Issue
Block a user