Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Conversation

@JabLuszko
Copy link
Contributor

No description provided.

@ofrinach
Copy link

Hey @JabLuszko ,
Line 124 in MadApkEndpoint.py should also be changed to allow .apkm files, otherwise a "Unsupported extension" response is returned

@JabLuszko
Copy link
Contributor Author

Hey @JabLuszko , Line 124 in MadApkEndpoint.py should also be changed to allow .apkm files, otherwise a "Unsupported extension" response is returned

True, totally forgot I renamed my testing .apkm to .zip.

return await self._json_response(data=data[apk_type])

def allowed_file(self, filename):
ALLOWED_EXTENSIONS = set(['apk', 'apkm', 'zip'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is equivalent to ALLOWED_EXTENSIONS = {'apk', 'apkm', 'zip'} which is more efficient as it doesnt create a list then convert it to a set. I dont think it matters in this context though.

This should be a global variable thats initialized once and referenced instead of initialized on every call.

@@ -537,12 +538,13 @@ def normalize_package(self) -> NoReturn:
apk = apkutils.APK().from_io(bytes_of_apk).parse_resource()
manifest = apk.get_manifest()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like manifest is no longer used. Should be good to remove the line.

elif not file.filename:
await self._add_notice_message('No file selected for uploading')
raise web.HTTPFound(self._url_for("upload"))
elif not allowed_file(file.filename):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is allowed_file utilized anywhere else? If not, the code should be removed to have a cleaner code base.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants