diff options
author | Kurian Vithayathil <kvithayathil@users.noreply.github.com> | 2022-09-21 05:56:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 05:56:26 +0000 |
commit | 0a182209982c8c5ada1869574634ee0cad48d8a8 (patch) | |
tree | 2d034c4cc375d12c832c9029b52a2e8473d41687 | |
parent | 1108d41eed544d68fa85daca5fdba564753e34ee (diff) | |
download | infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.gz infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.bz2 infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.lz infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.xz infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.tar.zst infinity-for-reddit-0a182209982c8c5ada1869574634ee0cad48d8a8.zip |
Fix 'Suggested Title' bug (#1120)
- Fixed issue where a post's suggested titles would fail to generate
Co-authored-by: Kurian Vithayathil <no.reply@github.com>
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java index 3db21105..562b55db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java @@ -9,6 +9,7 @@ import android.os.Handler; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.webkit.URLUtil; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; @@ -351,10 +352,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr suggestTitleButton.setOnClickListener(view -> { Toast.makeText(this, R.string.please_wait, Toast.LENGTH_SHORT).show(); String url = linkEditText.getText().toString().trim(); - if (!url.startsWith("https://") || !url.startsWith("http://")) { + if (!URLUtil.isHttpsUrl(url) && !URLUtil.isHttpUrl(url)) { url = "https://" + url; } - new Retrofit.Builder() + mRetrofit.newBuilder() .baseUrl("http://localhost/") .addConverterFactory(ScalarsConverterFactory.create()) .build().create(TitleSuggestion.class).getHtml(url).enqueue(new Callback<String>() { |