mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix: check if the temp dir exists before deleting it (#2141)
This commit is contained in:
parent
05e2566c35
commit
d639bdcfe9
@ -111,7 +111,9 @@ class AdminMaintenanceController(BaseAdminController):
|
||||
@router.post("/clean/temp", response_model=SuccessResponse)
|
||||
def clean_temp(self):
|
||||
try:
|
||||
shutil.rmtree(self.folders.TEMP_DIR)
|
||||
if self.folders.TEMP_DIR.exists():
|
||||
shutil.rmtree(self.folders.TEMP_DIR)
|
||||
|
||||
self.folders.TEMP_DIR.mkdir(parents=True, exist_ok=True)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=ErrorResponse.respond("Failed to clean temp")) from e
|
||||
|
Loading…
x
Reference in New Issue
Block a user