From 30e5f9b29095e97d224b00764e9cf49436e6b0a5 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sun, 10 Jun 2018 18:53:07 +0200 Subject: [PATCH] fix geo uri regex (fix #3050) (#3071) - only match valid float numbers - match uri with parameter --- src/main/java/eu/siacs/conversations/utils/GeoHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java index 6f411b108..755ec7cbe 100644 --- a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java @@ -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;