mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-24 23:09:42 -05:00
parent
02254b13bb
commit
f4b35f25d3
@ -25,7 +25,7 @@ import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
import mimetypes
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from flask import Response, request, render_template, make_response, abort
|
||||
from unidecode import unidecode
|
||||
from werkzeug.http import parse_date, http_date
|
||||
@ -127,7 +127,7 @@ class ShareModeWeb(SendBaseModeWeb):
|
||||
|
||||
self.download_etag = None
|
||||
self.gzip_etag = None
|
||||
self.last_modified = datetime.utcnow()
|
||||
self.last_modified = datetime.now(tz=timezone.utc)
|
||||
|
||||
def define_routes(self):
|
||||
"""
|
||||
@ -288,6 +288,8 @@ class ShareModeWeb(SendBaseModeWeb):
|
||||
if_unmod = request.headers.get("If-Unmodified-Since")
|
||||
if if_unmod:
|
||||
if_date = parse_date(if_unmod)
|
||||
if if_date and not if_date.tzinfo:
|
||||
if_date = if_date.replace(tzinfo=timezone.utc) # Compatible with Flask < 2.0.0
|
||||
if if_date and if_date > last_modified:
|
||||
abort(412)
|
||||
elif range_header is None:
|
||||
|
Loading…
Reference in New Issue
Block a user