bugfix
This commit is contained in:
parent
741fa6d2af
commit
97a80280b6
@ -67,21 +67,31 @@ class FileMgr:
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
bool = await self.is_folder_ownerid(sor, u.userorgid)
|
||||
if not bool:
|
||||
os.unlink(realpath)
|
||||
e = Exception(f'owner mismatch({u.userorgid=})')
|
||||
exception(f'{e=}\n{format_exc()}')
|
||||
raise
|
||||
quota, expired_date = await self.get_organization_quota(sor,
|
||||
u.userorgid)
|
||||
if quota is None:
|
||||
os.unlink(realpath)
|
||||
e = Exception(f'{u.userorgid} 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:
|
||||
os.unlink(realpath)
|
||||
self.message = f'{quota=}M, {quota_used=}M {filesize=} overused'
|
||||
e = Exception(f'{u.userorgid} quota overflow')
|
||||
exception(f'{e}\n{format_exc()}')
|
||||
raise e
|
||||
recs = await sor.R('file',{'hashvalue': hashvalue, 'ownerid': u.userorgid})
|
||||
if len(recs) > 0:
|
||||
os.unlink(realpath)
|
||||
e = Exception(f'File exists')
|
||||
exception(f'{e=}\n{format_exc()}')
|
||||
return False
|
||||
|
||||
recs = await sor.R('file',{'hashvalue': hashvalue})
|
||||
if len(recs) > 0:
|
||||
os.unlink(realpath)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user