Skip to content

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

Closed
@pocketcolin

Description

@pocketcolin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:releasedReleased as stable versionstate:released-alphaReleased as alpha versiontype:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions