Skip to content

Commit 4bce7e2

Browse files
fix: set active = 1 on insertResult when file is processing
Author: quentin <[email protected]>
1 parent c0f189c commit 4bce7e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/controllers/media.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ const uploadMedia = async (req: Request, res: Response, version:string): Promise
245245
const createdate = new Date(Math.floor(Date.now())).toISOString().slice(0, 19).replace("T", " ");
246246
const insertResult = await dbInsert(
247247
"mediafiles",
248-
["pubkey", "filename", "original_hash", "hash", "status", "visibility", "date", "ip_address", "magnet", "blurhash", "filesize", "comments"],
249-
[filedata.pubkey, filedata.filename, filedata.originalhash, filedata.hash, filedata.status, 1, createdate, getClientIp(req), filedata.magnet, filedata.blurhash, filedata.filesize, ""]);
248+
["pubkey", "filename", "original_hash", "hash", "status", "active", "visibility", "date", "ip_address", "magnet", "blurhash", "filesize", "comments"],
249+
[filedata.pubkey, filedata.filename, filedata.originalhash, filedata.hash, filedata.status, 1, 1, createdate, getClientIp(req), filedata.magnet, filedata.blurhash, filedata.filesize, ""]);
250250

251251
filedata.fileid = insertResult.toString();
252252
if (insertResult == 0) {
@@ -558,6 +558,7 @@ const getMediabyURL = async (req: Request, res: Response) => {
558558
res.setHeader('Content-Type', 'image/webp');
559559
return res.status(404).send(await getNotFoundMediaFile());
560560
}
561+
logger.debug(filedata[1])
561562
if (filedata[1] != "1") {
562563
logger.warn(`RES -> 401 File not active - ${req.url}`, "| Returning not found media file.", getClientIp(req));
563564

0 commit comments

Comments
 (0)