From 1a87ca1a1571178af259e7e2e6b1c3f2bdd8a00e Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Mon, 27 Nov 2023 16:36:47 +0100 Subject: [PATCH] updated code + minimal test --- safe_url_check/lib/safe_url_check.dart | 2 +- safe_url_check/test/safe_url_check_test.dart | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/safe_url_check/lib/safe_url_check.dart b/safe_url_check/lib/safe_url_check.dart index 7c6acd60..c7c6ba27 100644 --- a/safe_url_check/lib/safe_url_check.dart +++ b/safe_url_check/lib/safe_url_check.dart @@ -160,7 +160,7 @@ Future _safeUrlCheck( response.headers[HttpHeaders.locationHeader]!.isNotEmpty && maxRedirects > 0) { final loc = Uri.parse(response.headers[HttpHeaders.locationHeader]![0]); - final nextUri = loc.hasScheme ? loc : url.resolveUri(loc); + final nextUri = url.resolveUri(loc); return _safeUrlCheck( nextUri, maxRedirects - 1, diff --git a/safe_url_check/test/safe_url_check_test.dart b/safe_url_check/test/safe_url_check_test.dart index b2d7f0ab..b06a3f88 100644 --- a/safe_url_check/test/safe_url_check_test.dart +++ b/safe_url_check/test/safe_url_check_test.dart @@ -27,5 +27,6 @@ void main() { testValidUrl('https://google.com'); testValidUrl('https://github.com'); testValidUrl('https://github.com/google/dart-neats.git'); + testValidUrl('https://httpbin.org/redirect-to?url=status%2F200'); testInvalidUrl('https://github.com/google/dart-neats.git/bad-url'); }