Update fileApiRoutes.ts

This commit is contained in:
May 2023-05-13 11:37:38 -07:00 committed by GitHub
parent f4d7128e04
commit 6b6f05ea4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,15 +31,16 @@ fileApiRoutes.get("/list", (req,res) => {
let acc = Accounts.getFromToken(req.cookies.auth) let acc = Accounts.getFromToken(req.cookies.auth)
if (!acc) return if (!acc) return
let accId = acc.id
res.send(acc.files.map((e) => { res.send(acc.files.map((e) => {
let fp = files.getFilePointer(e) let fp = files.getFilePointer(e)
if (!fp) { Accounts.files.deindex(accId, e); return null }
return { return {
...fp, ...fp,
messageids: null, messageids: null,
owner: null, owner: null,
id:e, id:e
sizeDisplay: fp.sizeInBytes ? bytes(fp.sizeInBytes) : "[File size unknown]"
} }
})) }))