Accept dash character (-) in GitHub user names when checking for Gist URL

GitHub allows dash / minus characters in usernames (e.g. "wiktor-k" or
"open-keychain"). This change extends the regular expression to capture
this missing character.
This commit is contained in:
Wiktor Kwapisiewicz 2017-10-18 21:20:25 +02:00
parent 3a22c1f480
commit f2cda5dd6c

View file

@ -192,7 +192,7 @@ public class GithubResource extends LinkedTokenResource {
return null;
}
Pattern p = Pattern.compile("https://gist\\.github\\.com/([a-zA-Z0-9_]+)/([0-9a-f]+)");
Pattern p = Pattern.compile("https://gist\\.github\\.com/([a-zA-Z0-9_-]+)/([0-9a-f]+)");
Matcher match = p.matcher(uri.toString());
if (!match.matches()) {
return null;