Skip to content

Using double forward slash in URL returns HTML instead of performing an API request #9877

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

Closed
mafredri opened this issue Sep 26, 2023 · 0 comments · Fixed by #16527
Closed
Assignees

Comments

@mafredri
Copy link
Member

The issue can be demonstrated easily:

~
❯ curl https://dev.coder.com/api/v2/buildinfo
{"external_url":"https://github.com/coder/coder/commit/6f0e2a79683d30c2974fbe9cda5802f0b7c47d44","version":"v2.1.5-devel+6f0e2a796","dashboard_url":"https://dev.coder.com","workspace_proxy":false}

vs

~
❯ curl https://dev.coder.com//api/v2/buildinfo
<!doctype html>

<!--
    ▄█▀    ▀█▄
     ▄▄ ▀▀▀  █▌   ██▀▀█▄          ▐█
 ▄▄██▀▀█▄▄▄  ██  ██      █▀▀█ ▐█▀▀██ ▄█▀▀█ █▀▀
█▌   ▄▌   ▐█ █▌  ▀█▄▄▄█▌ █  █ ▐█  ██ ██▀▀  █
     ██████▀▄█    ▀▀▀▀   ▀▀▀▀  ▀▀▀▀▀  ▀▀▀▀ ▀
  -->

<head>

This could probably be considered a non-bug, but I'm reporting it as a bug. It's not an uncommon scenario when concatenating URLs (ran into this in #9852) that we could handle. Perhaps we can sanitize all (or at least most) // to /?

@mafredri mafredri added the bug label Sep 26, 2023
@github-actions github-actions bot added the stale This issue is like stale bread. label Mar 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
@mafredri mafredri reopened this Apr 2, 2024
@mafredri mafredri removed the stale This issue is like stale bread. label Apr 2, 2024
@matifali matifali removed the bug label Oct 14, 2024
@mtojek mtojek self-assigned this Feb 11, 2025
mtojek added a commit that referenced this issue Feb 12, 2025
Fixes: #9877

This PR introduces another middleware to rewrite URLs when multiple
slashes are used.
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 a pull request may close this issue.

3 participants