Skip to content

Commit d1e9b2f

Browse files
maskaravivekmisaochan
authored andcommitted
Fix errors while making image quality checks (#2444)
1 parent aee8839 commit d1e9b2f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/src/main/java/fr/free/nrw/commons/upload/ImageProcessingService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ private Single<Integer> checkDarkImage(String filePath) {
117117

118118
/**
119119
* Checks for image geolocation
120+
* returns IMAGE_OK if the place is null or if the file doesn't contain a geolocation
120121
* @param filePath file to be checked
121122
* @return IMAGE_GEOLOCATION_DIFFERENT or IMAGE_OK
122123
*/
@@ -127,6 +128,11 @@ private Single<Integer> checkImageGeoLocation(Place place, String filePath) {
127128
}
128129
return Single.fromCallable(() -> filePath)
129130
.map(fileUtilsWrapper::getGeolocationOfFile)
130-
.flatMap(geoLocation -> imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation()));
131+
.flatMap(geoLocation -> {
132+
if (StringUtils.isNullOrWhiteSpace(geoLocation)) {
133+
return Single.just(ImageUtils.IMAGE_OK);
134+
}
135+
return imageUtilsWrapper.checkImageGeolocationIsDifferent(geoLocation, place.getLocation());
136+
});
131137
}
132138
}

0 commit comments

Comments
 (0)