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

Fix: handle relative redirects that have url.scheme == '' #401

Merged
merged 6 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.3] - 2024-08-12

### Added

### Changed
- Avoid raising an exception when a relative url is used as redirect location.

## [1.3.2] - 2024-07-09

### Added
Expand Down
2 changes: 1 addition & 1 deletion kiota_http/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = '1.3.2'
VERSION: str = '1.3.3'
5 changes: 4 additions & 1 deletion kiota_http/middleware/redirect_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def _redirect_url(
except Exception as exc:
raise Exception(f"Invalid URL in location header: {exc}.")

if url.scheme != request.url.scheme and not options.allow_redirect_on_scheme_change:
if (
not url.is_relative_url and url.scheme != request.url.scheme
and not options.allow_redirect_on_scheme_change
):
raise Exception(
"Redirects with changing schemes not allowed by default.\
You can change this by modifying the allow_redirect_on_scheme_change\
Expand Down
Loading