relax file name matching for downloaded fit files

Seems like Garmin has changed the naming scheme of `.fit` files within the zip download when getting the original activity.
The scheme used to be `{activity_id}.fit.` but has been changed to `{activity_id}_ACTIVITY.fit`. This commit relaxes the name comparison.
This commit is contained in:
fachleitner 2020-11-07 07:58:22 +01:00 committed by GitHub
parent ec0b8e651d
commit 9072333a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,7 +335,7 @@ class GarminClient(object):
zip_file = zipfile.ZipFile(BytesIO(response.content), mode="r") zip_file = zipfile.ZipFile(BytesIO(response.content), mode="r")
for path in zip_file.namelist(): for path in zip_file.namelist():
fn, ext = os.path.splitext(path) fn, ext = os.path.splitext(path)
if fn == str(activity_id): if fn.startswith(str(activity_id)):
return ext[1:], zip_file.open(path).read() return ext[1:], zip_file.open(path).read()
return None, None return None, None