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,22 +117,23 @@ 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 \'')) appIds = appIds.map((appId) => appId
.first; .split(appId.startsWith('applicationId "') ? '"' : '\'')[1]);
appId = appId appIds = appIds.map((appId) {
.split(appId.startsWith('applicationId "') ? '"' : '\'')[1]; if (appId.startsWith('\${') && appId.endsWith('}')) {
if (appId.startsWith('\${') && appId.endsWith('}')) { appId = trimmedLines
appId = trimmedLines .where((l) => l.startsWith(
.where((l) => l.startsWith( 'def ${appId.substring(2, appId.length - 1)}'))
'def ${appId.substring(2, appId.length - 1)}')) .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(