Fix missing trailing slash for path-less URLs (#1715)

This commit is contained in:
Imran Remtulla
2024-07-14 20:27:42 -04:00
parent d1cb2688c6
commit 6a44fe227c

View File

@@ -355,8 +355,10 @@ preStandardizeUrl(String url) {
url = 'https://$url';
}
var uri = Uri.tryParse(url);
var trailingSlash = (uri?.path.endsWith('/') ?? false) &&
var trailingSlash = ((uri?.path.endsWith('/') ?? false) ||
((uri?.path.isEmpty ?? false) && url.endsWith('/'))) &&
(uri?.queryParameters.isEmpty ?? false);
url = url
.split('/')
.where((e) => e.isNotEmpty)