Commit a5e63b58 authored by contabo-server's avatar contabo-server
Browse files

fix delete condition

parent 5fca45f2
......@@ -17,7 +17,7 @@ def get_and_check_share(share_id, decrease_limit=False) -> Share:
if share.download_limit and decrease_limit:
share.download_limit -= 1
db.session.commit()
if (share.download_limit and share.download_limit < 0) or\
if (share.download_limit and share.download_limit <= 0) or\
(share.expires is not None and datetime.now() > share.expires):
que.enqueue(delete_share, share.id)
return None
......@@ -134,7 +134,7 @@ def media(share_id, filename):
@app.route('/d/<string:share_id>zip')
def zip_attachments(share_id):
share = get_and_check_share(share_id)
share = get_and_check_share(share_id, decrease_limit=True)
if share is None: return redirect(url_for('expired'))
if share.password:
if share_id not in session:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment