Skip to content

Check Storage Permission Before Upload #15240

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Jul 23, 2025

  • Tests written, or not not needed

Issue

Previously granted MANAGE_EXTERNAL_STORAGE or Only Media Access permission can be revoked if the app hasn't been used for a few months (e.g. if user not opens the app just using the app for auto upload) or after a system upgrade.

Screenshot 2025-07-23 at 13 35 00

Some other OS implementations may handle this differently, so we need to cover this edge case as well.
Also, it seems that some users have experienced this issue before and resolved it by re-granting the permission.

#15218 (comment)
#15039 (comment)

Changes

Image 1

Notes

PermissionUtil.requestExternalStoragePermission cannot be used to display the same permission dialog that appears at the beginning of the application, as it depends on AppCompatActivity. Therefore, we inform the user and provide them with the option to choose between the standard app permission or full file access.

@ZetaTom

Additionally, instead of handling the error after a failed upload, we proactively check for the necessary permissions before initiating the upload. This approach prevents unnecessary calls and simplifies the logic flow.

All files access action

Image 1

App permissions action

We cannot redirect to the directly to the storage permission page. There is no intent action for that.

Image 2

@alperozturk96 alperozturk96 added 3. to review ux-enhancement Improvements that refine user interactions, accessibility, or overall usability labels Jul 23, 2025
@alperozturk96 alperozturk96 force-pushed the check-manage-all-files-permission branch from 38a609b to 92df4ea Compare July 29, 2025 11:50
ZetaTom

This comment was marked as resolved.

@alperozturk96

This comment was marked as resolved.

@alperozturk96
Copy link
Collaborator Author

alperozturk96 commented Aug 7, 2025

Looks like full file access permission fixed the issue, please read the issue and comments.

#15039 (comment)
#15039 (comment)
#15039 (comment)
#15039 (comment)
#15039 (comment)

@alperozturk96 alperozturk96 force-pushed the check-manage-all-files-permission branch from 92df4ea to d446815 Compare August 7, 2025 11:11
@alperozturk96 alperozturk96 changed the title Check Storage Permission Before Auto Upload Check Storage Permission Before Upload Aug 7, 2025
@alperozturk96 alperozturk96 force-pushed the check-manage-all-files-permission branch from d83b4f9 to b7be9b8 Compare August 8, 2025 07:16
Copy link

github-actions bot commented Aug 8, 2025

Codacy

Lint

TypemasterPR
Warnings4848
Errors1111

SpotBugs

CategoryBaseNew
Bad practice6060
Correctness6363
Dodgy code296296
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3536
Performance5050
Security1818
Total532533

SpotBugs increased!

Copy link

github-actions bot commented Aug 8, 2025

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15240.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

.setAutoCancel(true)

ContextCompat.getSystemService(context, NotificationManager::class.java)?.run {
notify(MISSING_FILE_PERMISSION_NOTIFICATION_ID, notificationBuilder.build())

Check failure

Code scanning / CodeQL

Use of implicit PendingIntents High

An implicit Intent is created
and sent to an unspecified third party through a PendingIntent.

Copilot Autofix

AI about 4 hours ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review ux-enhancement Improvements that refine user interactions, accessibility, or overall usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android application should detect when "all files access" is not "allowed"
3 participants