Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wizzard apkm/zip split packages. #1387

Open
wants to merge 10 commits into
base: async
Choose a base branch
from

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.

@@ -39,6 +38,10 @@ async def get(self):
except KeyError:
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.

@@ -58,7 +61,7 @@ async def post(self):
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants