fix geo uri regex (fix #3050) (#3071)

- only match valid float numbers
- match uri with parameter
This commit is contained in:
Klaus 2018-06-10 18:53:07 +02:00 committed by Daniel Gultsch
parent d86f0787da
commit 30e5f9b290
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ public class GeoHelper {
private static final String SHARE_LOCATION_PACKAGE_NAME = "eu.siacs.conversations.location.request";
private static final String SHOW_LOCATION_PACKAGE_NAME = "eu.siacs.conversations.location.show";
public static Pattern GEO_URI = Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE);
public static Pattern GEO_URI = Pattern.compile("geo:(-?\\d+(?:\\.\\d+)?),(-?\\d+(?:\\.\\d+)?)(?:,-?\\d+(?:\\.\\d+)?)?(?:;crs=[\\w-]+)?(?:;u=\\d+(?:\\.\\d+)?)?(?:;[\\w-]+=(?:[\\w-_.!~*'()]|%[\\da-f][\\da-f])+)*", Pattern.CASE_INSENSITIVE);
public static boolean isLocationPluginInstalled(Context context) {
return new Intent(SHARE_LOCATION_PACKAGE_NAME).resolveActivity(context.getPackageManager()) != null;