Skip to content

Commit

Permalink
Fix #1249
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed Apr 18, 2020
1 parent 95ec7fc commit a1e0c2c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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;
Expand Down Expand Up @@ -94,7 +95,7 @@ public static boolean verifyApiFormat(@NonNull String format) {

@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
Expand All @@ -110,7 +111,7 @@ public static String getApiBaseUrl(@NonNull String format, @Nullable final Strin
} 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) {
Expand Down

0 comments on commit a1e0c2c

Please sign in to comment.