From 28a996441c5c6aed4d26afa30e8b299d9fe5c7dd Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Fri, 28 Apr 2023 22:18:58 -0400 Subject: [PATCH] HTML Source Bugfix #288 --- lib/app_sources/html.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 92178bf..8067b26 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -41,9 +41,14 @@ class HTML extends AppSource { } catch (err) { // is relative } - var currPathSegments = uri.path.split('/'); + var currPathSegments = uri.path + .split('/') + .where((element) => element.trim().isNotEmpty) + .toList(); if (e.startsWith('/') || currPathSegments.isEmpty) { return '${uri.origin}/$e'; + } else if (e.split('/').length == 1) { + return '${uri.origin}/${currPathSegments.join('/')}/$e'; } else { return '${uri.origin}/${currPathSegments.sublist(0, currPathSegments.length - 1).join('/')}/$e'; }