mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Flush file before passing it to next function
When downloading a repo index, the downloaded index got written to a
file with `.write()` in a `with` clause. Before the file got actually
written to the disk, it got already passed into the next function,
resulting in a `VerificationException`:
```
JAR signature failed to verify: /tmp/tmppq2r51r0
jarsigner: java.util.zip.ZipException: zip file is empty
```
This behavior got introduced in
869cc114a3
.
I've found this bug with help of Repomaker's tests: https://gitlab.com/fdroid/repomaker/merge_requests/215#note_148994053
This commit is contained in:
parent
edfd3cf530
commit
3798a884a6
1 changed files with 1 additions and 0 deletions
|
@ -717,6 +717,7 @@ def download_repo_index(url_str, etag=None, verify_fingerprint=True, timeout=600
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile() as fp:
|
with tempfile.NamedTemporaryFile() as fp:
|
||||||
fp.write(download)
|
fp.write(download)
|
||||||
|
fp.flush()
|
||||||
index, public_key, public_key_fingerprint = get_index_from_jar(fp.name, fingerprint)
|
index, public_key, public_key_fingerprint = get_index_from_jar(fp.name, fingerprint)
|
||||||
index["repo"]["pubkey"] = hexlify(public_key).decode()
|
index["repo"]["pubkey"] = hexlify(public_key).decode()
|
||||||
index["repo"]["fingerprint"] = public_key_fingerprint
|
index["repo"]["fingerprint"] = public_key_fingerprint
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue