Compare commits

...

2 Commits

Author SHA1 Message Date
Imran
3af185b0f8 Merge pull request #2552 from aminosred25/aminosred25-patch-1
Try to handle response body as a JSON first before handling it as a p…
2025-09-21 16:56:50 -04:00
aminosred25
bfbb2710b6 Try to handle response body as a JSON first before handling it as a plain text 2025-09-21 22:33:57 +02:00

View File

@@ -146,10 +146,7 @@ Future<List<MapEntry<String, String>>> grabLinksCommon(
.map((e) => MapEntry(ensureAbsoluteUrl(e.key, reqUrl), e.value))
.toList();
if (allLinks.isEmpty || matchLinksOutsideATags) {
allLinks = getLinksInLines(rawBody);
}
if (allLinks.isEmpty) {
// Getting desperate
// Decode the body if the response is a JSON
try {
var jsonStrings = collectAllStringsFromJSONObject(jsonDecode(rawBody));
allLinks = getLinksInLines(jsonStrings.join('\n'));
@@ -163,7 +160,7 @@ Future<List<MapEntry<String, String>>> grabLinksCommon(
);
}
} catch (e) {
//
allLinks = getLinksInLines(rawBody);
}
}
List<MapEntry<String, String>> links = [];