diff options
author | Joris | 2024-05-20 10:09:06 +0200 |
---|---|---|
committer | Joris | 2024-05-20 10:09:06 +0200 |
commit | 0167ad139146892c444fcfb2b4fe8d91a7871293 (patch) | |
tree | d16c6fca869b88113c14d227ad7232fd6c908127 /src | |
parent | 236ca262bc4a2f70d78c4725e31f951da7bc9ba6 (diff) |
Do not serve file if it has expired
Diffstat (limited to 'src')
-rw-r--r-- | src/db.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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() |