From 6c7dfdc46019f85d461d2db64202ba72504a3aa8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 12 Aug 2025 11:31:50 +0800 Subject: [PATCH] bugfix --- filemgr/filemgr.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/filemgr/filemgr.py b/filemgr/filemgr.py index fbfc4ba..f20885f 100644 --- a/filemgr/filemgr.py +++ b/filemgr/filemgr.py @@ -22,11 +22,6 @@ def get_dbname(): dbname = f('filemgr') return dbname -use_module_patches = { -} -def add_folder_patch(modulename, patch_func): - use_module_patches[modulename] = pathc_func - class FileMgr: def __init__(self, fiid, use_module): self.fiid = fiid @@ -74,14 +69,21 @@ class FileMgr: async with db.sqlorContext(dbname) as sor: bool = await self.is_folder_ownerid(sor, u.userorgid) if not bool: - return False + e = Exception(f'owner mismatch({u.userorgid=})') + exception(f'{e=}\n{format_exc()}') + raise quota, expired_date = await self.get_organization_quote(sor, u.userorgid) - + if quota is None: + e = Exception(f'{ownerid} has not quota') + exception('f'{e}\n{format_exc()}') + raise e quota_used = await self.get_quota_used(sor, u.userorgid) if quota_used + filesize / 1000000 >= quota: self.message = f'{quota=}M, {quota_used=}M {filesize=} overused' - return False + e = Exception(f'{ownerid} quota overflow') + exception(f'{e}\n{format_exc()}') + raise e recs = await sor.R('file',{'hashvalue': hashvalue}) if len(recs) > 0: os.unlink(realpath)