回收站-永久删除修复

pull/814/head
dami 5 days ago
parent 8684e21da3
commit cb211d8ba1
  1. 8
      web/admin/files/recycle.py
  2. 14
      web/utils/file.py

@ -21,7 +21,7 @@ import core.mw as mw
import utils.file as file
from .files import blueprint
# 回收站文件
# 回收站文件列表
@blueprint.route('/get_recycle_bin', endpoint='get_recycle_bin', methods=['POST'])
@panel_login_required
def get_recycle_bin():
@ -34,6 +34,12 @@ def re_recycle_bin():
path = request.form.get('path', '')
return file.reRecycleBin(path)
@blueprint.route('/del_recycle_bin', endpoint='del_recycle_bin', methods=['POST'])
@panel_login_required
def del_recycle_bin():
path = request.form.get('path', '')
return file.delRecycleBin(path)
# 回收站文件
@blueprint.route('/recycle_bin', endpoint='recycle_bin', methods=['POST'])
@panel_login_required

@ -838,6 +838,20 @@ def getRecycleBin():
return mw.returnJson(True, 'OK', data)
def delRecycleBin(path):
rb_dir = mw.getRecycleBinDir()
rb_file = rb_dir + '/' + path
if os.path.isdir(rb_file):
import shutil
shutil.rmtree(rb_file)
else:
os.remove(rb_file)
tfile = path.replace('_mw_', '/').split('_t_')[0]
msg = mw.getInfo('已彻底从回收站删除{1}!', (tfile,))
mw.writeLog('文件管理', msg)
return mw.returnJson(True, msg)
# 移动到回收站
def mvRecycleBin(path):
rb_dir = mw.getRecycleBinDir()

Loading…
Cancel
Save