From 08bfebb09ec0e8e170c6c1bccc43083e80e5cb6f Mon Sep 17 00:00:00 2001 From: The one with the braid Date: Mon, 14 Oct 2024 21:21:18 +0200 Subject: [PATCH] fix: handle trailing slash in web service Signed-off-by: The one with the braid --- lib/pkpass/models/pass_web_service.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pkpass/models/pass_web_service.dart b/lib/pkpass/models/pass_web_service.dart index 52c664c..c9f2ba0 100644 --- a/lib/pkpass/models/pass_web_service.dart +++ b/lib/pkpass/models/pass_web_service.dart @@ -21,6 +21,10 @@ class PassWebService { String? webServiceURL, }) { if (authenticationToken == null || webServiceURL == null) return null; + // normalize the end of the URL + if (webServiceURL.endsWith('/')) { + webServiceURL = webServiceURL.substring(0, webServiceURL.length - 1); + } final uri = Uri.tryParse(webServiceURL); if (uri == null || uri.scheme != 'https') return null; return PassWebService(