Repository navigation
Preserve escaped paths when joining parsed URLs - #495
Open
harshitdeora wants to merge 1 commit into
Open
harshitdeora wants to merge 1 commit into
harshitdeora wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
urlJoin (urlParse "https://example.com/a%2Fb")currently produceshttps://example.com/a/b: parsing discardsnet/url.URL.RawPath, so joining turns an encoded slash into a path separator. This can address a different resource.Keep an optional
rawPathentry when the parsed URL contains a non-default path encoding, and pass it back tonet/url.URLwhen joining. The existing decodedpathentry is unchanged. If a caller editspath, Go's URL formatter ignores an inconsistent raw path and escapes the edited path normally. The docs describe the optional entry.Four regression cases fail before the fix and pass after, through both direct calls and template pipelines. They cover uppercase/lowercase escaped slashes, combined escaping/query/fragment, and a relative URL. A further control checks editing the decoded path.
go test ./... -skip '^TestHtmlDate$' -count=1,go vet ./..., gofmt andgit diff --checkpass on Windows/amd64 with Go 1.25.3. The unfiltered suite has a local timezone-dependent failure in the existingTestHtmlDate(expects June 13 for a GMT timestamp that is June 14 in IST); no date code is changed. The upstream Go/platform matrix has not been run locally.Found while inspecting URL round-trip behavior; no existing issue is claimed.