Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: validate server URL has a host#57

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/validate-url-host
Feb 18, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedFeb 18, 2025
edited
Loading

Closes#53.

The linked issue was caused by a subtle difference in how we add paths to the server URLs in Go and Swift

In both languages, the (erroneous) urlhttps:/dev.coder.com is parsed the same:

  • Scheme:https
  • Host: "" /nil
  • Relative Path:/dev.coder.com

However, in Swift, when we transform a server URL into a specific route on that server, such as/api/v2/users/me, we don't replace any existing part of the relative path, we just append to it, producinghttp:/dev.coder.com/api/v2/users/me, which gets sent, and the server responds to, just fine.

In Go, when we do the same transformation, we callsvrURL.Parse("/api/v2/users/me"), which replaces the existing relative path,/dev.coder.com, leading to the error in the linked issue, which has nodev.coder.com portion at all.

Previously, we were only ensuring that the link was a valid URL, and that the scheme washttps.
Now, we'll require that all server URLs have a host component. This meanshttp:/dev.coder.com fails to validate with a better error message.

@ethanndicksonGraphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ethanndicksonethanndickson marked this pull request as ready for reviewFebruary 18, 2025 05:21
@ethanndicksonethanndickson merged commit393d240 intomainFeb 18, 2025
4 checks passed
@ethanndicksonethanndickson deleted the ethan/validate-url-host branchFebruary 18, 2025 11:25
@ethanndicksonethanndickson self-assigned thisMay 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@hugodutkahugodutkahugodutka approved these changes

Assignees

@ethanndicksonethanndickson

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

App does not validate server URLs
2 participants
@ethanndickson@hugodutka

[8]ページ先頭

©2009-2025 Movatter.jp