From 7b692ce72dafc846027ed13f596c91d08bebea1d Mon Sep 17 00:00:00 2001 From: Liplum Date: Sun, 26 May 2024 03:24:19 +0800 Subject: [PATCH] [network] definitely fixed --- lib/utils/dio.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/dio.dart b/lib/utils/dio.dart index f62c760bc..6bfd46b95 100644 --- a/lib/utils/dio.dart +++ b/lib/utils/dio.dart @@ -1,4 +1,5 @@ import 'package:dio/dio.dart'; +import 'package:sit/utils/strings.dart'; Options disableRedirectFormEncodedOptions({ Map? headers, @@ -29,7 +30,8 @@ Future processRedirect( if (location.isEmpty) return response; final locationUri = Uri.parse(location); if (!locationUri.isAbsolute) { - location = '${response.requestOptions.uri.origin}/$location'; + // to prevent double-slash issue + location = '${response.requestOptions.uri.origin.removeSuffix("/")}/${location.removePrefix("/")}'; } final redirectedResponse = await dio.get( location,