FIX: dav_submission: empty timezone and spoofing fields in metadata.txt
All checks were successful
buildbot/tox Build done.

This commit is contained in:
2020-04-28 11:26:13 +02:00
parent 142f37faaf
commit 02bdea21cb

View File

@@ -68,11 +68,16 @@ class ListView(generic.ListView):
date_str = mo.group(1)
time_str = mo.group(2)
zone_str = mo.group(3)
if not zone_str:
zone_str = timezone.get_current_timezone_name()
datetime_str = '{} {}'.format(date_str, time_str)
timestamp = datetime.datetime.strptime(datetime_str, '%d.%m.%Y %H:%M:%S')
tz = pytz.timezone(zone_str)
metadata['timestamp'] = tz.localize(timestamp)
continue
mo = re.match(r'^Beschreibung:$', line)
if mo is not None:
break
all_metadata[subdir] = metadata