pulsar-edit / package-backend

Pulsar Server Backend for Packages
https://api.pulsar-edit.dev
MIT License
12 stars 11 forks source link

Use `URL` without failure #36

Closed confused-Techie closed 1 year ago

confused-Techie commented 1 year ago

Requirements

Description of the Change

A recent PR re-enabled the use of URL to ensure we only redirect users to safe locations.

But there was some confusion about which URL module we wanted to use, because we had been importing a url module from NPM, but on that PR became aware that NodeJS has one included by default.

So this PR now uses NodeJS's url module, which changed the way we imported it. I've also gone ahead and added a test to ensure this works as expected, and redirects to the correct location.

Lastly in this PR, I've caused a malformed URL to actually return a server error rather than still attempt a redirect