mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
server/posts: fix source file deletion
This commit is contained in:
@ -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:
|
||||
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user