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

Remove all GPS metadata from images uploaded as media #3781

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

jmartinesp
Copy link
Member

Content

Removes all GPS related EXIF metadata from images sent as media (images sent as files will be kept as they are).

Motivation and context

Previously a minimal set of tags were removed, but we should make sure every single one of them is removed.

Tests

  • Get an image with GPS metadata (you can download one of these).
  • Send it as media in a room with 'photo & video library' option.
  • Download the file and pass it through an EXIF metadata viewer, it should have no GPS info.

Maybe do the same while taking a picture using the camera.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

Previously a minimal set of tags were removed, but we should make sure every single one of them is removed.
@jmartinesp jmartinesp added the PR-Feature For a new feature label Oct 31, 2024
@jmartinesp jmartinesp requested a review from a team as a code owner October 31, 2024 12:31
@jmartinesp jmartinesp requested review from ganfra and removed request for a team October 31, 2024 12:31
Copy link
Contributor

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/WH3JKF

Copy link

sonarcloud bot commented Oct 31, 2024

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.95%. Comparing base (057ef38) to head (8fb0784).
Report is 16 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3781      +/-   ##
===========================================
+ Coverage    82.93%   82.95%   +0.01%     
===========================================
  Files         1771     1771              
  Lines        44483    44514      +31     
  Branches      5222     5222              
===========================================
+ Hits         36894    36925      +31     
  Misses        5754     5754              
  Partials      1835     1835              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I guess? :D

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 31, 2024
@jmartinesp jmartinesp enabled auto-merge (squash) October 31, 2024 14:53
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 31, 2024
// See ExifInterface.TAG_GPS_INFO_IFD_POINTER
exifInterface.setAttribute("GPSInfoIFDPointer", null)
exifInterface.setAttribute(ExifInterface.TAG_USER_COMMENT, null)
exifInterface.setAttribute(ExifInterface.TAG_SUBJECT_LOCATION, null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAG_SUBJECT_LOCATION is not in the new list, has it been removed by mistake?

Copy link
Member Author

@jmartinesp jmartinesp Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was added by mistake before, so I removed it. The docs say:

Indicates the location of the main subject in the scene. The value of this tag represents
the pixel at the center of the main subject relative to the left edge, prior to rotation
processing as per {@link #TAG_ORIENTATION}. The first value indicates the X column number
and second indicates the Y row number. When a camera records the main subject location,
it is recommended that {@link #TAG_SUBJECT_AREA} be used instead of this tag.

So it's not user location, but some metadata to help image viewers locate the 'important' part of the image.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for explaining!

@everypizza1
Copy link

I think that this should be behind a toggle, because sometimes I want to send an image to someone with location data.

@jmartinesp
Copy link
Member Author

I think that this should be behind a toggle, because sometimes I want to send an image to someone with location data.

You can still send the image as a file and it'll be sent with no changes.

@jmartinesp jmartinesp merged commit f7861ac into develop Nov 4, 2024
33 of 34 checks passed
@jmartinesp jmartinesp deleted the feat/jme/remove-gps-exif-metadata-from-images branch November 4, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Feature For a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants