mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-09 07:27:02 +08:00
[Server] Move user files to trash on delete calls
This commit is contained in:
parent
eade1551bb
commit
aefc6ffe5d
@ -1,4 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -6,12 +7,15 @@ import uuid
|
|||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
|
from typing import TypedDict
|
||||||
|
|
||||||
|
import send2trash
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
|
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
import folder_paths
|
import folder_paths
|
||||||
from .app_settings import AppSettings
|
from .app_settings import AppSettings
|
||||||
from typing import TypedDict
|
|
||||||
|
|
||||||
default_user = "default"
|
default_user = "default"
|
||||||
|
|
||||||
@ -274,7 +278,11 @@ class UserManager():
|
|||||||
if not isinstance(path, str):
|
if not isinstance(path, str):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
os.remove(path)
|
try:
|
||||||
|
send2trash.send2trash(path)
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Error moving file to trash: {e}")
|
||||||
|
return web.Response(status=500, text="Failed to move file to trash")
|
||||||
|
|
||||||
return web.Response(status=204)
|
return web.Response(status=204)
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ Pillow
|
|||||||
scipy
|
scipy
|
||||||
tqdm
|
tqdm
|
||||||
psutil
|
psutil
|
||||||
|
send2trash>=1.8.3
|
||||||
|
|
||||||
#non essential dependencies:
|
#non essential dependencies:
|
||||||
kornia>=0.7.1
|
kornia>=0.7.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user