From 430d1f26909484b4caf28bf427eee39a7aea958e Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Fri, 21 Feb 2025 10:22:49 -0500 Subject: [PATCH] Fix "Bad State: No element" Error on Some Direct APK Links (#2128) --- lib/app_sources/html.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index cc81521..86d73e4 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -358,10 +358,12 @@ class HTML extends AppSource { .toString(); return APKDetails( version, - [rel] - .map((e) => - MapEntry('${e.hashCode}-${Uri.parse(e).pathSegments.last}', e)) - .toList(), + [rel].map((e) { + var uri = Uri.parse(e); + var fileName = + uri.pathSegments.isNotEmpty ? uri.pathSegments.last : uri.origin; + return MapEntry('${e.hashCode}-$fileName', e); + }).toList(), AppNames(uri.host, tr('app'))); } }