[BUG] Automatic picture uploads strip GPS location from photos (missing ACCESS_MEDIA_LOCATION) Actual behaviour on Android

Abierto Apto para principiantes
#5,040 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, kotlin

Línea de trabajo

Empieza comprobando owncloudApp/src/main/AndroidManifest.xml para localizar el permiso ACCESS_MEDIA_LOCATION que falta y la ruta de gestión de permisos; el punto de entrada de la subida mencionado en el informe se llama UploadFileFromContentUriWorker. Después de conceder el permiso, compara una subida automática con la foto original, incluidos su SHA-256 y sus metadatos GPS. El trabajo estará terminado cuando la subida conserve los datos de la foto original y se informe a los usuarios que rechacen el permiso de que los metadatos de ubicación pueden eliminarse.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Camera Uploads Contributions are welcome Technical

Photos uploaded by Automatic uploads → Picture uploads reach the server with their GPS location removed on Android. Nothing warns the user, so a backup quietly differs from the original.

The uploaded file is the same size as the original but not byte-identical. The only difference is a run of 43–48 bytes inside the EXIF GPS block, all set to zero in the uploaded copy. All other EXIF data (camera model, exposure, timestamps) is untouched. That pattern is Android's media-location redaction, not an EXIF edit: on Android 10+ the system blanks location metadata for any app reading media without android.permission.ACCESS_MEDIA_LOCATION. The ownCloud app doesn't declare this permission (it's absent from owncloudApp/src/main/AndroidManifest.xml on master), so every photo it reads arrives already redacted.

Expected behaviour:

Automatic uploads should send a byte-identical copy of the original photo, including its location metadata (as they do already on the iOS client) If the user declines the media-location permission, the app should at least say that uploads will have their location removed instead of quietly altering like this.

Steps to reproduce:

On an Android 10+ device, turn on location tagging in the camera app.
In ownCloud, turn on Settings → Automatic uploads → Picture uploads, with the source folder set to DCIM/Camera.
Take a photo and wait for it to upload.
Download the uploaded file (web UI or WebDAV) and compare it with the original from the device:
    exiftool -gps:all uploaded.jpg shows no position (e.g. GPSLatitudeRef: Unknown ()), while the original has one.
    cmp -l original.jpg uploaded.jpg shows about 45 differing bytes, all 0 in the uploaded file.

Verified fix

I rebuilt the same 4.8.4 APK with a single change, adding this line to the binary manifest (no code changes), re-signed it, and installed it with the permission granted:

After that, new automatic uploads are byte-identical to the originals (matching SHA-256) with GPS intact. The current Storage Access Framework read path (DocumentFile.fromTreeUri → contentResolver.openInputStream in UploadFileFromContentUriWorker) needs no other change. Android just stops redacting once the app holds the permission.

Note on #3056: that issue (missing geotags with "Picture from camera") was closed with "it is not in our plans to add the location permission in the app". ACCESS_MEDIA_LOCATION is not a device-location permission. It doesn't let the app see where the phone is. It only lets the app read location data that is already stored in the user's own photos. Nextcloud's Android client, which started as a fork of this codebase, declares it for the same reason. iOS owncloud client also keeps this location data intact, so it's an os differentiation that's not desirable either.

Video uploads are probably affected the same way, since Android also redacts location in video metadata, but I haven't verified that.

Environment data

Android version: 17 (ColorOS 17)

Device model: OPPO Find N6 (CPH2765)

Stock or customized system: Stock

ownCloud app version: 4.8.4 (Google Play)

ownCloud server version: 10.16.6 Community
Logs
Web server error log

N/A — the upload succeeds without errors; the file content is altered on the device before upload.

ownCloud log (data/owncloud.log)

N/A — no errors are logged.

Lenguaje dominante
Kotlin
Estrellas
4.2k
Forks
3.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
16

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de owncloud/android

Todos los issues de owncloud/android

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.