Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTOR-6709 Fix URLParserException on minimal file url #4622

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

adriandieter
Copy link
Contributor

Subsystem
Core, ktor-http

Motivation
Resolves KTOR-6709 Fail to parse url: file:/path/to/file.txt. URLParser does not support file urls with a single leading /.

Solution
Add when clause to URLBuilder.parseFilefor extension function to match a single leading slash.
It sets the host to empty string and the rest of the url as encodedPath.

Does not modify how URLBuilders toString() is implemented. Leading to Url("file:/var/www").toString() returning "file:///var/www".

@e5l
Copy link
Member

e5l commented Jan 24, 2025

Hey @adriandieter. Thank you for the PR, LGTM

@adriandieter adriandieter force-pushed the KTOR-6709-parse-file-url branch from fa06c78 to f5444f4 Compare January 27, 2025 09:52
@osipxd osipxd enabled auto-merge (squash) January 27, 2025 15:19
@osipxd
Copy link
Member

osipxd commented Jan 27, 2025

@adriandieter, could you rebase this PR one more time, please? I'm going to merge it

auto-merge was automatically disabled January 28, 2025 10:24

Head branch was pushed to by a user without write access

@adriandieter adriandieter force-pushed the KTOR-6709-parse-file-url branch from f5444f4 to 3493b11 Compare January 28, 2025 10:24
@osipxd osipxd merged commit 15f0921 into ktorio:main Jan 28, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants