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

fix: Build the URL using url.JoinPath instead of path.Join #249

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

MikeGoldsmith
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith commented Jun 13, 2024

Which problem is this PR solving?

There is a weird bug in setting a URL path directly, where it will escape some characters, but not all.

This go playground example shows it. The unescaped value is used directly, the escaped value double escapes some of the characters.

This PR uses url.PathJoin instead, which is intended to handle URLs.

Short description of the changes

  • Update the URL builder to use url.JoinPath and return any errors
  • Update Transmission to use updated builder func and handle error like before
  • Update tests to handle errors

@MikeGoldsmith MikeGoldsmith self-assigned this Jun 13, 2024
@MikeGoldsmith MikeGoldsmith requested a review from a team as a code owner June 13, 2024 16:14
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

transmission/transmission.go Outdated Show resolved Hide resolved
transmission/transmission.go Outdated Show resolved Hide resolved
@MikeGoldsmith MikeGoldsmith changed the title fix: Build the URL using path.Join and not appending to url.Path fix: Build the URL using url.JoinPath instead of path.Join Jun 13, 2024
@MikeGoldsmith MikeGoldsmith merged commit 9f4f37c into main Jun 13, 2024
6 checks passed
@MikeGoldsmith MikeGoldsmith deleted the mike/fix-encoded-url branch June 13, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants