From ef39c2f79b8044ad9e7ba7a8cb2648c9f0bb3b00 Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 4 Jan 2021 02:36:07 +0500 Subject: [PATCH] =?UTF-8?q?Remove=20ex=D1=81essive=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapcontextmenu/builders/AmenityMenuBuilder.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index 25976b644f..0a6ebe16d9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -61,7 +61,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.regex.Pattern; import androidx.annotation.NonNull; import androidx.appcompat.view.ContextThemeWrapper; @@ -897,14 +896,6 @@ public class AmenityMenuBuilder extends MenuBuilder { } private String getSocialMediaUrl(String key, String value) { - // Regex for url without protocol, with at least 2 valid domains, slash and at least one - // char after it (e.g. a-c.com/a) - String urlMask = "[a-zA-Z0-9]+[-]*[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+[-]*[a-zA-Z0-9]+)+\\/.+"; - - if (Pattern.matches(urlMask, value)) { - return "https://" + value; - } - // Remove leading and closing slashes StringBuilder sb = new StringBuilder(value.trim()); if (sb.charAt(0) == '/') { @@ -916,8 +907,8 @@ public class AmenityMenuBuilder extends MenuBuilder { } // It cannot be username - if (sb.indexOf("/") != -1 || sb.indexOf(" ") != -1) { - return null; + if (sb.indexOf("/") != -1) { + return "https://" + value; } Map urls = new HashMap<>(7);