invalidate cache on media operations
This commit is contained in:
parent
2bf6776931
commit
f23d463a1a
|
|
@ -40,6 +40,7 @@ from .utils import (
|
||||||
rename_folder,
|
rename_folder,
|
||||||
delete_folder,
|
delete_folder,
|
||||||
save_uploaded_image,
|
save_uploaded_image,
|
||||||
|
_scan_cache_invalidate,
|
||||||
validate_path_security,
|
validate_path_security,
|
||||||
get_all_tags,
|
get_all_tags,
|
||||||
get_notes_by_tag,
|
get_notes_by_tag,
|
||||||
|
|
@ -861,7 +862,8 @@ async def move_media_endpoint(request: Request, data: dict):
|
||||||
# Move the file
|
# Move the file
|
||||||
import shutil
|
import shutil
|
||||||
shutil.move(str(old_full_path), str(new_full_path))
|
shutil.move(str(old_full_path), str(new_full_path))
|
||||||
|
_scan_cache_invalidate()
|
||||||
|
|
||||||
return {"success": True, "message": "Media moved successfully", "newPath": new_path}
|
return {"success": True, "message": "Media moved successfully", "newPath": new_path}
|
||||||
|
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
|
|
|
||||||
|
|
@ -735,6 +735,7 @@ def save_uploaded_image(
|
||||||
try:
|
try:
|
||||||
with open(full_path, "wb") as f:
|
with open(full_path, "wb") as f:
|
||||||
f.write(file_data)
|
f.write(file_data)
|
||||||
|
_scan_cache_invalidate()
|
||||||
return str(full_path.relative_to(base).as_posix())
|
return str(full_path.relative_to(base).as_posix())
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.error("Error saving image: %s", e)
|
logger.error("Error saving image: %s", e)
|
||||||
|
|
@ -754,6 +755,7 @@ def save_uploaded_image(
|
||||||
try:
|
try:
|
||||||
with open(full_path, "wb") as f:
|
with open(full_path, "wb") as f:
|
||||||
f.write(file_data)
|
f.write(file_data)
|
||||||
|
_scan_cache_invalidate()
|
||||||
return str(full_path.relative_to(base).as_posix())
|
return str(full_path.relative_to(base).as_posix())
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.error("Error saving image: %s", e)
|
logger.error("Error saving image: %s", e)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue