Merge branch 'feature/14' into dev

ID: 14
Type: feature
Title: add compression support for urllib PkgHandler
Status: done
Priority: high
Created: 2025-06-21
Description: with a proper content-type of the PkgHandler addinfourl object, a
             consumer can determine whether the file is compressed or not.
This commit is contained in:
Tiara Rodney 2025-06-21 20:27:58 +02:00
commit 32ae99c5fa
No known key found for this signature in database
GPG key ID: 5F43FAB4FBE5B5EB
2 changed files with 5 additions and 2 deletions

2
TODO
View file

@ -200,7 +200,7 @@ Description: change of issue 12 wasn't properly reflected in urllib PkgHandler
ID: 14
Type: feature
Title: add compression support for urllib PkgHandler
Status: in-progress
Status: done
Priority: high
Created: 2025-06-21
Description: with a proper content-type of the PkgHandler addinfourl object, a

View file

@ -22,7 +22,10 @@ class PkgHandler(urllib.request.BaseHandler):
size = fh.tell();
fh.seek(0);
mtype, _ = mimetypes.guess_type(req.selector)
mtype, compression = mimetypes.guess_type(req.selector)
if compression and mtype:
mtype = f"{mtype}+{compression}"
headers = email.message_from_string(
'Content-Type: %s\nContent-Length: %d\n' %