From a1e0c2c7b8fdcb0439f4b7a970fb3ed5dd3fa52d Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sat, 18 Apr 2020 13:43:43 +0800 Subject: [PATCH] Fix #1249 --- .../org/mariotaku/twidere/util/MicroBlogAPIFactory.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java b/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java index a85f8a342..3446d8e0f 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java @@ -6,11 +6,12 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; +import android.text.TextUtils; +import android.webkit.URLUtil; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; -import android.text.TextUtils; -import android.webkit.URLUtil; import org.mariotaku.microblog.library.MicroBlog; import org.mariotaku.restfu.http.Endpoint; @@ -94,7 +95,7 @@ public class MicroBlogAPIFactory implements TwidereConstants { @NonNull public static String getApiBaseUrl(@NonNull String format, @Nullable final String domain) { - final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)]", Pattern.CASE_INSENSITIVE).matcher(format); + final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)](\\.?)", Pattern.CASE_INSENSITIVE).matcher(format); final String baseUrl; if (!matcher.find()) { // For backward compatibility @@ -110,7 +111,7 @@ public class MicroBlogAPIFactory implements TwidereConstants { } else if (TextUtils.isEmpty(domain)) { baseUrl = matcher.replaceAll(""); } else { - baseUrl = matcher.replaceAll("$1" + domain + "$2"); + baseUrl = matcher.replaceAll("$1" + domain + "." + "$2"); } // In case someone set invalid base url if (HttpUrl.parse(baseUrl) == null) {