From 0167ad139146892c444fcfb2b4fe8d91a7871293 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 20 May 2024 10:09:06 +0200 Subject: Do not serve file if it has expired --- src/db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/db.py b/src/db.py index 8aa20f8..a6e29fd 100644 --- a/src/db.py +++ b/src/db.py @@ -13,7 +13,11 @@ def insert_file(conn, filename: str, expiration_days: int, content_length: int): def get_file(conn, file_id: str): cur = conn.cursor() res = cur.execute( - 'SELECT filename, expires, content_length FROM files WHERE id = ?', + ''' + SELECT filename, expires, content_length + FROM files + WHERE id = ? AND expires > datetime() + ''', (file_id,) ) return res.fetchone() -- cgit v1.2.3