invalidate cache on media operations

This commit is contained in:
Gamosoft 2026-06-30 17:44:05 +02:00
parent 2bf6776931
commit f23d463a1a
2 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,7 @@ from .utils import (
rename_folder,
delete_folder,
save_uploaded_image,
_scan_cache_invalidate,
validate_path_security,
get_all_tags,
get_notes_by_tag,
@ -861,7 +862,8 @@ async def move_media_endpoint(request: Request, data: dict):
# Move the file
import shutil
shutil.move(str(old_full_path), str(new_full_path))
_scan_cache_invalidate()
return {"success": True, "message": "Media moved successfully", "newPath": new_path}
except HTTPException:

View File

@ -735,6 +735,7 @@ def save_uploaded_image(
try:
with open(full_path, "wb") as f:
f.write(file_data)
_scan_cache_invalidate()
return str(full_path.relative_to(base).as_posix())
except OSError as e:
logger.error("Error saving image: %s", e)
@ -754,6 +755,7 @@ def save_uploaded_image(
try:
with open(full_path, "wb") as f:
f.write(file_data)
_scan_cache_invalidate()
return str(full_path.relative_to(base).as_posix())
except OSError as e:
logger.error("Error saving image: %s", e)