server/posts: fix source file deletion

This commit is contained in:
ItsKaa
2024-11-17 12:15:33 +01:00
committed by Eva
parent 7972c34448
commit 3f42037e2b
2 changed files with 3 additions and 3 deletions

View File

@ -25,8 +25,8 @@ def scan(path: str) -> List[Any]:
return []
def find(path: str, pattern: str) -> List[Any]:
return glob.glob(glob.escape(_get_full_path(path) + "/") + pattern)
def find(path: str, pattern: str, recursive: bool = False) -> List[Any]:
return glob.glob(glob.escape(_get_full_path(path) + "/") + pattern, recursive=recursive)
def move(source_path: str, target_path: str) -> None:

View File

@ -481,7 +481,7 @@ def _before_post_delete(
) -> None:
if post.post_id:
if config.config["delete_source_files"]:
pattern = post.post_id + "_*"
pattern = f"{post.post_id}_*"
for file in files.find("posts", "**/" + pattern, recursive=True) + files.find("generated-thumbnails", "**/sample_" + pattern, recursive=True):
files.delete(file)