Merge pull request #69 from PhotonQyv/FixMalformedURLException_SharingIntent

Added a fix for a url that arrives sans 'http://'.
This commit is contained in:
Thomas 2017-11-29 13:22:35 +01:00 committed by GitHub
commit b0060ec145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -51,6 +51,10 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
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