Skip to content

Commit

Permalink
updated code + minimal test
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Nov 27, 2023
1 parent 291b2b8 commit 1a87ca1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion safe_url_check/lib/safe_url_check.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Future<bool> _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,
Expand Down
1 change: 1 addition & 0 deletions safe_url_check/test/safe_url_check_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit 1a87ca1

Please sign in to comment.