Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixes for link handling regressions #1133

Merged
merged 4 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/main/java/com/gh4a/resolver/LinkParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public static ParseResult parseUri(FragmentActivity activity, @NonNull Uri uri,
return parseNewBlogLink(activity, parts);
}

if (!"github.com".equals(uri.getHost())) {
return null;
}

if (parts.isEmpty()) {
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/gh4a/widget/LinkSpan.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ private void launchActivity(LinkParser.ParseResult result, FragmentActivity acti

private void openWebPage(Uri clickedUri, FragmentActivity activity) {
String hostname = clickedUri.getHost();
if (hostname == null) {
// The user clicked on a relative or partial URL, there's nothing we can do
Fs00 marked this conversation as resolved.
Show resolved Hide resolved
return;
}

if (hostname.endsWith("github.com") || hostname.endsWith("githubusercontent.com")) {
IntentUtils.openInCustomTabOrBrowser(activity, clickedUri);
} else {
Expand Down
Loading