GitHub: Don't infer AppID if many found (#1112)

This commit is contained in:
Imran Remtulla
2023-11-24 19:24:19 -05:00
parent 1a4ec3f049
commit 7e5dfa03d6

View File

@@ -117,13 +117,12 @@ class GitHub extends AppSource {
.decode(body['content'].toString().split('\n').join(''))) .decode(body['content'].toString().split('\n').join('')))
.split('\n') .split('\n')
.map((e) => e.trim()); .map((e) => e.trim());
var appId = trimmedLines var appIds = trimmedLines.where((l) =>
.where((l) =>
l.startsWith('applicationId "') || l.startsWith('applicationId "') ||
l.startsWith('applicationId \'')) l.startsWith('applicationId \''));
.first; appIds = appIds.map((appId) => appId
appId = appId .split(appId.startsWith('applicationId "') ? '"' : '\'')[1]);
.split(appId.startsWith('applicationId "') ? '"' : '\'')[1]; appIds = appIds.map((appId) {
if (appId.startsWith('\${') && appId.endsWith('}')) { if (appId.startsWith('\${') && appId.endsWith('}')) {
appId = trimmedLines appId = trimmedLines
.where((l) => l.startsWith( .where((l) => l.startsWith(
@@ -131,8 +130,10 @@ class GitHub extends AppSource {
.first; .first;
appId = appId.split(appId.contains('"') ? '"' : '\'')[1]; appId = appId.split(appId.contains('"') ? '"' : '\'')[1];
} }
if (appId.isNotEmpty) {
return appId; return appId;
}).where((appId) => appId.isNotEmpty);
if (appIds.length == 1) {
return appIds.first;
} }
} catch (err) { } catch (err) {
LogsProvider().add( LogsProvider().add(