From acd84de03da66680408c10a3b8d5ee2fac937420 Mon Sep 17 00:00:00 2001 From: bluecasita <154034577+bluecasita@users.noreply.github.com> Date: Thu, 24 Sep 2026 21:38:16 -0500 Subject: [PATCH] fix: preserve GPS metadata in uploaded photos and videos Since Android 10 the system redacts location EXIF from media read through the media store or SAF unless the app holds ACCESS_MEDIA_LOCATION and asks for the original with MediaStore.setRequireOriginal(). The app never declared the permission, so automatic uploads (and uploads of shared or picked media) lost their GPS tags while the rest of the EXIF survived. - declare ACCESS_MEDIA_LOCATION in the manifest - request it only from the picture/video automatic-uploads settings, when uploads are enabled (not on app start), with a snackbar on denial - add MediaLocationUtils to resolve a content URI to its unredacted original (media store URIs directly, SAF document URIs via MediaStore.getMediaUri) and use it where upload sources are read: UploadFileFromContentUriWorker and CopyAndUploadContentUrisTask; any failure falls back to the previous behaviour - Robolectric tests for MediaLocationUtils Fixes #218 Co-Authored-By: Claude Fable 5.1 --- opencloudApp/src/main/AndroidManifest.xml | 6 ++ .../SettingsPictureUploadsFragment.kt | 21 +++++ .../SettingsVideoUploadsFragment.kt | 21 +++++ .../CopyAndUploadContentUrisTask.java | 3 +- .../android/utils/MediaLocationUtils.kt | 90 +++++++++++++++++++ .../workers/UploadFileFromContentUriWorker.kt | 3 +- opencloudApp/src/main/res/values/strings.xml | 1 + .../android/utils/MediaLocationUtilsTest.kt | 89 ++++++++++++++++++ 8 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 opencloudApp/src/main/java/eu/opencloud/android/utils/MediaLocationUtils.kt create mode 100644 opencloudApp/src/test/java/eu/opencloud/android/utils/MediaLocationUtilsTest.kt diff --git a/opencloudApp/src/main/AndroidManifest.xml b/opencloudApp/src/main/AndroidManifest.xml index 38c990ad1a..1ac899e3f2 100644 --- a/opencloudApp/src/main/AndroidManifest.xml +++ b/opencloudApp/src/main/AndroidManifest.xml @@ -23,6 +23,12 @@ API >= 23; the app needs to handle this --> + +