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