-
Notifications
You must be signed in to change notification settings - Fork 132
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
base: async
Are you sure you want to change the base?
Conversation
Hey @JabLuszko , |
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']) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
No description provided.