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

Can't execute APK file downloaded from assets in versions page, on Android #14164

Closed
2 of 6 tasks
pokapow opened this issue Dec 28, 2020 · 9 comments · Fixed by #15133
Closed
2 of 6 tasks

Can't execute APK file downloaded from assets in versions page, on Android #14164

pokapow opened this issue Dec 28, 2020 · 9 comments · Fixed by #15133
Labels
good first issue Likely to be an easy fix type/enhancement An improvement of existing functionality

Comments

@pokapow
Copy link

pokapow commented Dec 28, 2020

Description

When download APK android installer from version assets in Gitea on mobile, when click the link from APK we can't juste download and execute to install the app.

Instead, browser want to open it with archive unzipper.

If we download the same APK form nextcloud for exemple, Android try to install it directly...

It's not very usefull when we want to share our mobile app from github versions page...

@gsantner
Copy link

probably only a matter of mime type response header

@pokapow
Copy link
Author

pokapow commented Dec 28, 2020

I think so yes, maybe it can be fix by changing mime type in gitea links ?

@Seil0
Copy link

Seil0 commented Jan 1, 2021

I got the same issue. When trying to download a .apk file it is downloaded as .zip file.

Gitea version (or commit ref): 1.13.1

@gsantner
Copy link

gsantner commented Jan 1, 2021

Mime Type should be:
application/vnd.android.package-archive

@zeripath
Copy link
Contributor

zeripath commented Jan 1, 2021

Are you using an http proxy?

@pokapow
Copy link
Author

pokapow commented Jan 2, 2021

Yes nginx.

I tried solutions write here: https://stackoverflow.com/questions/46285863/set-headers-for-apk-files-served-by-nginx

But it's doesn't work for me, since Gitea .apk download URL doesn't have the extension inside URL, I think that's the problem.

@gsantner
Copy link

gsantner commented Jan 3, 2021

I have gitea with apache. If there's a solution and it requires change to webserver config - makes sense to mention it in docs

@zeripath
Copy link
Contributor

zeripath commented Jan 3, 2021

So you're trying to download the automatically generated archive files which have filenames *.zip as .apk?

@techknowlogick
Copy link
Member

The below is out put from querying the apk from the try.gitea.io link above, seems the content type we are providing is Content-Type: application/zip, I think we are getting the content type from net/http's DetectContentType. A quick/dirty way would be to check if file is determined to be a zip, but has an extension of .apk then we modify the content-type response.

> http https://try.gitea.io/attachments/8d500ecf-0c93-4409-9f94-8801ba4000c0  ~
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Content-Disposition
Cache-Control: public,max-age=86400
Content-Disposition: attachment; filename="Speed Check Light 5G 4G LTE WiFi_v2.1.1.0_apkpure.com.apk"
Content-Type: application/zip
Date: Sun, 10 Jan 2021 02:25:51 GMT
...

@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 14, 2021
@techknowlogick techknowlogick added the good first issue Likely to be an easy fix label Mar 7, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Likely to be an easy fix type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants