mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 13:26:43 +02:00
Fix error when GitLab repo is in a subgroup (#2079)
This commit is contained in:
@ -501,7 +501,7 @@ class GitHub extends AppSource {
|
|||||||
AppNames getAppNames(String standardUrl) {
|
AppNames getAppNames(String standardUrl) {
|
||||||
String temp = standardUrl.substring(standardUrl.indexOf('://') + 3);
|
String temp = standardUrl.substring(standardUrl.indexOf('://') + 3);
|
||||||
List<String> names = temp.substring(temp.indexOf('/') + 1).split('/');
|
List<String> names = temp.substring(temp.indexOf('/') + 1).split('/');
|
||||||
return AppNames(names[0], names[1]);
|
return AppNames(names[0], names.sublist(1).join('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, List<String>>> searchCommon(
|
Future<Map<String, List<String>>> searchCommon(
|
||||||
|
@ -54,7 +54,7 @@ class GitLab extends AppSource {
|
|||||||
@override
|
@override
|
||||||
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
|
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
|
||||||
RegExp standardUrlRegEx = RegExp(
|
RegExp standardUrlRegEx = RegExp(
|
||||||
'^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+/[^/]+',
|
'^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) {
|
||||||
@ -126,6 +126,8 @@ class GitLab extends AppSource {
|
|||||||
) async {
|
) async {
|
||||||
// Prepare request params
|
// Prepare request params
|
||||||
var names = GitHub().getAppNames(standardUrl);
|
var names = GitHub().getAppNames(standardUrl);
|
||||||
|
String projectUriComponent =
|
||||||
|
'${Uri.encodeComponent(names.author)}%2F${Uri.encodeComponent(names.name)}';
|
||||||
String? PAT = await getPATIfAny(hostChanged ? additionalSettings : {});
|
String? PAT = await getPATIfAny(hostChanged ? additionalSettings : {});
|
||||||
String optionalAuth = (PAT != null) ? 'private_token=$PAT' : '';
|
String optionalAuth = (PAT != null) ? 'private_token=$PAT' : '';
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ class GitLab extends AppSource {
|
|||||||
|
|
||||||
// Get project ID
|
// Get project ID
|
||||||
Response res0 = await sourceRequest(
|
Response res0 = await sourceRequest(
|
||||||
'https://${hosts[0]}/api/v4/projects/${names.author}%2F${names.name}?$optionalAuth',
|
'https://${hosts[0]}/api/v4/projects/$projectUriComponent?$optionalAuth',
|
||||||
additionalSettings);
|
additionalSettings);
|
||||||
if (res0.statusCode != 200) {
|
if (res0.statusCode != 200) {
|
||||||
throw getObtainiumHttpError(res0);
|
throw getObtainiumHttpError(res0);
|
||||||
@ -145,7 +147,7 @@ class GitLab extends AppSource {
|
|||||||
|
|
||||||
// Request data from REST API
|
// Request data from REST API
|
||||||
Response res = await sourceRequest(
|
Response res = await sourceRequest(
|
||||||
'https://${hosts[0]}/api/v4/projects/${names.author}%2F${names.name}/${trackOnly ? 'repository/tags' : 'releases'}?$optionalAuth',
|
'https://${hosts[0]}/api/v4/projects/$projectUriComponent/${trackOnly ? 'repository/tags' : 'releases'}?$optionalAuth',
|
||||||
additionalSettings);
|
additionalSettings);
|
||||||
if (res.statusCode != 200) {
|
if (res.statusCode != 200) {
|
||||||
throw getObtainiumHttpError(res);
|
throw getObtainiumHttpError(res);
|
||||||
@ -180,7 +182,7 @@ class GitLab extends AppSource {
|
|||||||
return APKDetails(
|
return APKDetails(
|
||||||
e['tag_name'] ?? e['name'],
|
e['tag_name'] ?? e['name'],
|
||||||
getApkUrlsFromUrls(apkUrlsSet.toList()),
|
getApkUrlsFromUrls(apkUrlsSet.toList()),
|
||||||
GitHub().getAppNames(standardUrl),
|
AppNames(names.author, names.name.split('/').last),
|
||||||
releaseDate: releaseDate);
|
releaseDate: releaseDate);
|
||||||
});
|
});
|
||||||
if (apkDetailsList.isEmpty) {
|
if (apkDetailsList.isEmpty) {
|
||||||
|
Reference in New Issue
Block a user