mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-20 17:53:46 +02:00
Merge pull request #1254 from ImranR98/dev
URL parsing bugfix for HTML source (#1253)
This commit is contained in:
@@ -17,13 +17,17 @@ String ensureAbsoluteUrl(String ambiguousUrl, Uri referenceAbsoluteUrl) {
|
||||
.split('/')
|
||||
.where((element) => element.trim().isNotEmpty)
|
||||
.toList();
|
||||
String absoluteUrl;
|
||||
if (ambiguousUrl.startsWith('/') || currPathSegments.isEmpty) {
|
||||
return '${referenceAbsoluteUrl.origin}/$ambiguousUrl';
|
||||
absoluteUrl = '${referenceAbsoluteUrl.origin}/$ambiguousUrl';
|
||||
} else if (ambiguousUrl.split('/').where((e) => e.isNotEmpty).length == 1) {
|
||||
return '${referenceAbsoluteUrl.origin}/${currPathSegments.join('/')}/$ambiguousUrl';
|
||||
absoluteUrl =
|
||||
'${referenceAbsoluteUrl.origin}/${currPathSegments.join('/')}/$ambiguousUrl';
|
||||
} else {
|
||||
return '${referenceAbsoluteUrl.origin}/${currPathSegments.sublist(0, currPathSegments.length - (currPathSegments.last.contains('.') ? 1 : 0)).join('/')}/$ambiguousUrl';
|
||||
absoluteUrl =
|
||||
'${referenceAbsoluteUrl.origin}/${currPathSegments.sublist(0, currPathSegments.length - (currPathSegments.last.contains('.') ? 1 : 0)).join('/')}/$ambiguousUrl';
|
||||
}
|
||||
return Uri.parse(absoluteUrl).toString();
|
||||
}
|
||||
|
||||
int compareAlphaNumeric(String a, String b) {
|
||||
@@ -172,6 +176,8 @@ class HTML extends AppSource {
|
||||
? element.text
|
||||
: (element.attributes['href'] ?? '').split('/').last))
|
||||
.where((element) => element.key.isNotEmpty)
|
||||
.map((e) =>
|
||||
MapEntry(ensureAbsoluteUrl(e.key, res.request!.url), e.value))
|
||||
.toList();
|
||||
if (allLinks.isEmpty) {
|
||||
allLinks = RegExp(
|
||||
@@ -258,7 +264,6 @@ class HTML extends AppSource {
|
||||
additionalSettings['versionExtractWholePage'] == true
|
||||
? res.body.split('\r\n').join('\n').split('\n').join('\\n')
|
||||
: rel);
|
||||
rel = ensureAbsoluteUrl(rel, uri);
|
||||
version ??= (await checkDownloadHash(rel)).toString();
|
||||
return APKDetails(version, [rel].map((e) => MapEntry(e, e)).toList(),
|
||||
AppNames(uri.host, tr('app')));
|
||||
|
@@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
|
||||
// ignore: implementation_imports
|
||||
import 'package:easy_localization/src/localization.dart';
|
||||
|
||||
const String currentVersion = '0.15.5';
|
||||
const String currentVersion = '0.15.6';
|
||||
const String currentReleaseTag =
|
||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
|
||||
|
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 0.15.5+241 # When changing this, update the tag in main() accordingly
|
||||
version: 0.15.6+242 # When changing this, update the tag in main() accordingly
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
|
Reference in New Issue
Block a user