From 93c8bca038df7680bc7e036c5782da6d10c3fbf1 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Thu, 13 Feb 2025 09:55:25 -0500 Subject: [PATCH] GitLab URL parsing bugfix (#2106) --- lib/app_sources/gitlab.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/app_sources/gitlab.dart b/lib/app_sources/gitlab.dart index b47e891..70bbcd0 100644 --- a/lib/app_sources/gitlab.dart +++ b/lib/app_sources/gitlab.dart @@ -53,8 +53,12 @@ class GitLab extends AppSource { @override 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( - '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+(/[^/]+){1,20}', + '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+(/[^/-]+){1,20}', caseSensitive: false); RegExpMatch? match = standardUrlRegEx.firstMatch(url); if (match == null) {