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

Parse Hooks requests have double forward slash in URL (which is an issue for Express 5.x) #2406

Open
4 tasks done
pocketcolin opened this issue Jan 13, 2025 · 1 comment
Open
4 tasks done
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@pocketcolin
Copy link
Contributor

New Issue Checklist

Issue Description

An Express 4.x oddity allowed requests to be made with a double forward slash in the URL if it was between the router and route (discussed here). This is an anti-pattern and shouldn't be allowed. It looks like because of the way some routes are created in this SDK, a double forward slash is automatically being added to some internal requests. This requires us to make Parse Server continue supporting double forward-slashes even though it's really not advisable.

It's fairly easy to track the issue down in the code. You can see paths that start with forward slashes here:
https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src/ParseHooks.ts#L77

And then the REST controller checks if the Server URL ends with a forward slash and, if it doesn't it adds one before tacking on the path:
https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src/RESTController.ts#L235

Steps to reproduce

Run any call that triggers an internal REST call to Hooks or (I think) Files and observe the URL used internally. You will see something like this:

http://localhost:1337/parse//hooks/functions

I discovered this running Parse Server Hooks integration tests so that's another way to reproduce this issue.

Actual Outcome

Doubled up forward slashes.

Expected Outcome

The SDK should not be doubling up the forward slashes.

Server

  • Parse Server version: 7.4.0
    Client
  • Parse JS SDK version: 5.3.0
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants