bugfix
This commit is contained in:
parent
faa645c6d0
commit
6c7dfdc460
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user