GitLab URL parsing bugfix (#2106)

This commit is contained in:
Imran Remtulla
2025-02-13 09:55:25 -05:00
parent 66c08f0bfd
commit 93c8bca038

View File

@ -53,8 +53,12 @@ class GitLab extends AppSource {
@override @override
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
var urlSegments = url.split('/');
var cutOffIndex = urlSegments.indexWhere((s) => s == '-');
url =
urlSegments.sublist(0, cutOffIndex <= 0 ? null : cutOffIndex).join('/');
RegExp standardUrlRegEx = RegExp( RegExp standardUrlRegEx = RegExp(
'^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+(/[^/]+){1,20}', '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+(/[^/-]+){1,20}',
caseSensitive: false); caseSensitive: false);
RegExpMatch? match = standardUrlRegEx.firstMatch(url); RegExpMatch? match = standardUrlRegEx.firstMatch(url);
if (match == null) { if (match == null) {