mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix error if regex can't find the filename (#3285)
* fix: treat error if regex doesn't match * refactor: use assertion to avoid error message
This commit is contained in:
parent
a2b4b57390
commit
70a063a3b9
1 changed files with 4 additions and 2 deletions
|
@ -1086,9 +1086,11 @@ def download_addon(client: HttpClient, id: int) -> DownloadOk | DownloadError:
|
||||||
|
|
||||||
data = client.stream_content(resp)
|
data = client.stream_content(resp)
|
||||||
|
|
||||||
fname = re.match(
|
match = re.match(
|
||||||
"attachment; filename=(.+)", resp.headers["content-disposition"]
|
"attachment; filename=(.+)", resp.headers["content-disposition"]
|
||||||
).group(1)
|
)
|
||||||
|
assert match is not None
|
||||||
|
fname = match.group(1)
|
||||||
|
|
||||||
meta = extract_meta_from_download_url(resp.url)
|
meta = extract_meta_from_download_url(resp.url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue