This repository was archived by the owner on Oct 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Fix wizzard apkm/zip split packages. #1387
Open
JabLuszko
wants to merge
10
commits into
Map-A-Droid:async
Choose a base branch
from
JabLuszko:patch-49
base: async
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b7d84ae
Update wizard.py
JabLuszko e9098d7
Update MadApkEndpoint.py
JabLuszko 4119ae8
Update MadApkEndpoint.py
JabLuszko ffb1b46
Update MadApkEndpoint.py
JabLuszko dc39ec9
apks -> apkm
JabLuszko 3ddf47b
Update MadApkInfoEndpoint.py
JabLuszko 51e677b
Update MadApkInfoEndpoint.py
JabLuszko 7e76166
Update MadApkDownloadEndpoint.py
JabLuszko 8f8a356
Update MadApkInfoEndpoint.py
JabLuszko 82d67a3
Update MadApkDownloadEndpoint.py
JabLuszko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,6 @@ | |
| from mapadroid.mad_apk.wizard import APKWizard, PackageImporter, WizardError | ||
| from mapadroid.madmin.AbstractMadminRootEndpoint import ( | ||
| AbstractMadminRootEndpoint, check_authorization_header) | ||
| from mapadroid.madmin.functions import allowed_file | ||
| from mapadroid.utils.apk_enums import APKArch, APKType | ||
| from mapadroid.utils.custom_types import MADapks | ||
|
|
||
|
|
@@ -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']) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is equivalent to This should be a global variable thats initialized once and referenced instead of initialized on every call. |
||
| return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | ||
|
|
||
| async def post(self): | ||
| apk_type_raw: str = self.request.match_info.get('apk_type') | ||
| apk_arch_raw: str = self.request.match_info.get('apk_arch') | ||
|
|
@@ -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): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
| elif not self.allowed_file(file.filename): | ||
| await self._add_notice_message('Allowed file type is apk only!') | ||
| raise web.HTTPFound(self._url_for("upload")) | ||
| filename = secure_filename(file.filename) | ||
|
|
@@ -118,7 +121,7 @@ async def handle_file_upload(self, apk: io.BytesIO, apk_arch: Optional[APKArch], | |
| except KeyError: | ||
| return web.Response(text="Non-supported Type / Architecture", status=406) | ||
| filename_split = filename.rsplit('.', 1) | ||
| if filename_split[1] in ['zip', 'apks']: | ||
| if filename_split[1] in ['zip', 'apkm']: | ||
| mimetype = 'application/zip' | ||
| elif filename_split[1] == 'apk': | ||
| mimetype = 'application/vnd.android.package-archive' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.