From 7ff6916e5fa41896e193408541fadc5d1994e3af Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Thu, 12 Oct 2023 18:57:47 -0400 Subject: [PATCH] Better relative link resolution (#989) --- lib/app_sources/html.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 4cb9b26..ee1593a 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -22,7 +22,7 @@ String ensureAbsoluteUrl(String ambiguousUrl, Uri referenceAbsoluteUrl) { } else if (ambiguousUrl.split('/').where((e) => e.isNotEmpty).length == 1) { return '${referenceAbsoluteUrl.origin}/${currPathSegments.join('/')}/$ambiguousUrl'; } else { - return '${referenceAbsoluteUrl.origin}/${currPathSegments.sublist(0, currPathSegments.length - 1).join('/')}/$ambiguousUrl'; + return '${referenceAbsoluteUrl.origin}/${currPathSegments.sublist(0, currPathSegments.length - (currPathSegments.last.contains('.') ? 1 : 0)).join('/')}/$ambiguousUrl'; } }