mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Compare commits
2 Commits
7972c34448
...
2fb2ffb2e1
Author | SHA1 | Date | |
---|---|---|---|
2fb2ffb2e1 | |||
3f42037e2b |
@ -25,8 +25,8 @@ def scan(path: str) -> List[Any]:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def find(path: str, pattern: str) -> List[Any]:
|
def find(path: str, pattern: str, recursive: bool = False) -> List[Any]:
|
||||||
return glob.glob(glob.escape(_get_full_path(path) + "/") + pattern)
|
return glob.glob(glob.escape(_get_full_path(path) + "/") + pattern, recursive=recursive)
|
||||||
|
|
||||||
|
|
||||||
def move(source_path: str, target_path: str) -> None:
|
def move(source_path: str, target_path: str) -> None:
|
||||||
|
@ -129,7 +129,7 @@ def get_post_custom_thumbnail_url(post: model.Post) -> str:
|
|||||||
return "%s/generated-thumbnails/custom-thumbnails/sample_%d_%s.jpg" % (
|
return "%s/generated-thumbnails/custom-thumbnails/sample_%d_%s.jpg" % (
|
||||||
config.config["data_url"].rstrip("/"),
|
config.config["data_url"].rstrip("/"),
|
||||||
post.post_id,
|
post.post_id,
|
||||||
post.image_key,
|
get_post_security_hash(post.post_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ def get_post_custom_content_path(post: model.Post) -> str:
|
|||||||
assert post.post_id
|
assert post.post_id
|
||||||
return "posts/custom-thumbnails/%d_%s.dat" % (
|
return "posts/custom-thumbnails/%d_%s.dat" % (
|
||||||
post.post_id,
|
post.post_id,
|
||||||
post.image_key,
|
get_post_security_hash(post.post_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ def _before_post_delete(
|
|||||||
) -> None:
|
) -> None:
|
||||||
if post.post_id:
|
if post.post_id:
|
||||||
if config.config["delete_source_files"]:
|
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):
|
for file in files.find("posts", "**/" + pattern, recursive=True) + files.find("generated-thumbnails", "**/sample_" + pattern, recursive=True):
|
||||||
files.delete(file)
|
files.delete(file)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user