Skip to content

Fix edit button shown when image has no location #6029

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.os.Parcelable
import androidx.exifinterface.media.ExifInterface

import fr.free.nrw.commons.upload.FileUtils
import fr.free.nrw.commons.upload.ImageCoordinates
import java.io.File
import java.io.IOException
import java.util.Date
Expand Down Expand Up @@ -87,9 +88,7 @@ class UploadableFile : Parcelable {
fun hasLocation(): Boolean {
return try {
val exif = ExifInterface(file.absolutePath)
val latitude = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE)
val longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)
latitude != null && longitude != null
ImageCoordinates(exif, null).imageCoordsExists
} catch (e: IOException) {
Timber.tag("UploadableFile").d(e)
false
Expand Down
Loading