Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 2995db7

Browse files
authored
Merge pull request #401 from ldeluigi/patch-1
Fix: handle relative redirects that have url.scheme == ''
2 parents 61fa6e7 + eb41d38 commit 2995db7

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.3] - 2024-08-12
9+
10+
### Added
11+
12+
### Changed
13+
- Avoid raising an exception when a relative url is used as redirect location.
14+
815
## [1.3.2] - 2024-07-09
916

1017
### Added

kiota_http/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION: str = '1.3.2'
1+
VERSION: str = '1.3.3'

kiota_http/middleware/redirect_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def _redirect_url(
174174
except Exception as exc:
175175
raise Exception(f"Invalid URL in location header: {exc}.")
176176

177-
if url.scheme != request.url.scheme and not options.allow_redirect_on_scheme_change:
177+
if (
178+
not url.is_relative_url and url.scheme != request.url.scheme
179+
and not options.allow_redirect_on_scheme_change
180+
):
178181
raise Exception(
179182
"Redirects with changing schemes not allowed by default.\
180183
You can change this by modifying the allow_redirect_on_scheme_change\

0 commit comments

Comments
 (0)