mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
fix timezone in search, zipfiles, fuse
This commit is contained in:
parent
e7cd922d8b
commit
715401ca8e
|
@ -42,6 +42,7 @@ import threading
|
|||
import traceback
|
||||
import http.client # py2: httplib
|
||||
import urllib.parse
|
||||
import calendar
|
||||
from datetime import datetime
|
||||
from urllib.parse import quote_from_bytes as quote
|
||||
from urllib.parse import unquote_to_bytes as unquote
|
||||
|
@ -495,7 +496,7 @@ class Gateway(object):
|
|||
ts = 60 * 60 * 24 * 2
|
||||
try:
|
||||
sz = int(fsize)
|
||||
ts = datetime.strptime(fdate, "%Y-%m-%d %H:%M:%S").timestamp()
|
||||
ts = calendar.timegm(time.strptime(fdate, "%Y-%m-%d %H:%M:%S"))
|
||||
except:
|
||||
info("bad HTML or OS [{}] [{}]".format(fdate, fsize))
|
||||
# python cannot strptime(1959-01-01) on windows
|
||||
|
|
|
@ -45,6 +45,7 @@ import threading
|
|||
import traceback
|
||||
import http.client # py2: httplib
|
||||
import urllib.parse
|
||||
import calendar
|
||||
from datetime import datetime
|
||||
from urllib.parse import quote_from_bytes as quote
|
||||
from urllib.parse import unquote_to_bytes as unquote
|
||||
|
@ -443,7 +444,7 @@ class Gateway(object):
|
|||
ts = 60 * 60 * 24 * 2
|
||||
try:
|
||||
sz = int(fsize)
|
||||
ts = datetime.strptime(fdate, "%Y-%m-%d %H:%M:%S").timestamp()
|
||||
ts = calendar.timegm(time.strptime(fdate, "%Y-%m-%d %H:%M:%S"))
|
||||
except:
|
||||
info("bad HTML or OS [{}] [{}]".format(fdate, fsize))
|
||||
# python cannot strptime(1959-01-01) on windows
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import print_function, unicode_literals
|
|||
|
||||
import time
|
||||
import zlib
|
||||
from datetime import datetime
|
||||
import calendar
|
||||
|
||||
from .sutil import errdesc
|
||||
from .util import yieldfile, sanitize_fn, spack, sunpack, min_ex
|
||||
|
@ -25,8 +25,8 @@ def dostime2unix(buf):
|
|||
tf = "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}"
|
||||
iso = tf.format(*tt)
|
||||
|
||||
dt = datetime.strptime(iso, "%Y-%m-%d %H:%M:%S")
|
||||
return int(dt.timestamp())
|
||||
dt = time.strptime(iso, "%Y-%m-%d %H:%M:%S")
|
||||
return int(calendar.timegm(dt))
|
||||
|
||||
|
||||
def unixtime2dos(ts):
|
||||
|
|
|
@ -4,8 +4,8 @@ from __future__ import print_function, unicode_literals
|
|||
import re
|
||||
import os
|
||||
import time
|
||||
import calendar
|
||||
import threading
|
||||
from datetime import datetime
|
||||
from operator import itemgetter
|
||||
|
||||
from .__init__ import ANYWIN, unicode
|
||||
|
@ -190,18 +190,17 @@ class U2idx(object):
|
|||
|
||||
if is_date:
|
||||
is_date = False
|
||||
v = v.upper().rstrip("Z").replace(",", " ").replace("T", " ")
|
||||
while " " in v:
|
||||
v = v.replace(" ", " ")
|
||||
|
||||
v = re.sub(r"[tzTZ, ]+", " ", v).strip()
|
||||
for fmt in [
|
||||
"%Y-%m-%d %H:%M:%S",
|
||||
"%Y-%m-%d %H:%M",
|
||||
"%Y-%m-%d %H",
|
||||
"%Y-%m-%d",
|
||||
"%Y-%m",
|
||||
"%Y",
|
||||
]:
|
||||
try:
|
||||
v = datetime.strptime(v, fmt).timestamp()
|
||||
v = calendar.timegm(time.strptime(v, fmt))
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -4056,6 +4056,9 @@ document.onkeydown = function (e) {
|
|||
vs = ebi('srch_' + k + 'v').value,
|
||||
tvs = [];
|
||||
|
||||
if (a == 1)
|
||||
vs = vs.trim().replace(/ +/, 'T');
|
||||
|
||||
while (vs) {
|
||||
vs = vs.trim();
|
||||
if (!vs)
|
||||
|
|
Loading…
Reference in a new issue