From 8433fdc8c235084e64ed7b81d28d80d87ca60e91 Mon Sep 17 00:00:00 2001 From: PhotonQyv Date: Wed, 29 Nov 2017 11:32:08 +0000 Subject: [PATCH 1/2] Added a fix for a url that arrives sans 'http://', which would cause failure. --- .../etalab/mastodon/asynctasks/RetrieveMetaDataAsyncTask.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveMetaDataAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveMetaDataAsyncTask.java index c30180682..c1f5ca994 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveMetaDataAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveMetaDataAsyncTask.java @@ -51,6 +51,10 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask { String potentialUrl = ""; try { Matcher matcher; + + if (url.startsWith("www.")) + url = "http://" + url; + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) matcher = Patterns.WEB_URL.matcher(url); else From 4e23de5f32f09793c423b94d77683eb6e0e27748 Mon Sep 17 00:00:00 2001 From: PhotonQyv Date: Wed, 29 Nov 2017 12:15:38 +0000 Subject: [PATCH 2/2] Added code to put the 'http://' onto a URL in the actual toot, so that Mastodon web app treats it as a URL too. --- .../java/fr/gouv/etalab/mastodon/activities/TootActivity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index 30e03d3ee..662a376e2 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -392,6 +392,8 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc String title = intent.getStringExtra("title"); String description = intent.getStringExtra("description"); if( description != null && description.length() > 0){ + if (sharedContentIni.startsWith("www.")) + sharedContentIni = "http://" + sharedContentIni; if( title != null && title.length() > 0) sharedContent = title + "\n\n" + description + "\n\n" + sharedContentIni; else