another chrome bug:

navigating somewhere and back can return a REALLY OLD copy of the page
This commit is contained in:
ed
2021-05-29 12:31:06 +02:00
parent 8b53c159fc
commit 97be495861
2 changed files with 30 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ import threading
import mimetypes
import contextlib
import subprocess as sp # nosec
from datetime import datetime
from .__init__ import PY2, WINDOWS, ANYWIN
from .stolen import surrogateescape
@@ -47,6 +48,9 @@ if WINDOWS and PY2:
FS_ENCODING = "utf-8"
HTTP_TS_FMT = "%a, %d %b %Y %H:%M:%S GMT"
HTTPCODE = {
200: "OK",
204: "No Content",
@@ -652,6 +656,11 @@ def exclude_dotfiles(filepaths):
return [x for x in filepaths if not x.split("/")[-1].startswith(".")]
def http_ts(ts):
file_dt = datetime.utcfromtimestamp(ts)
return file_dt.strftime(HTTP_TS_FMT)
def html_escape(s, quote=False, crlf=False):
"""html.escape but also newlines"""
s = s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")