pulsar-edit / package-backend

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

Add support for any valid repository declaration during publication #246

Closed confused-Techie closed 3 months ago

confused-Techie commented 4 months ago

Requirements

Description of the Change

Previously the repository parameter validation was rather strict, using custom regex that would only accept a repository declared as owner/repo format. But since the parameter is taken directly from a user's package.json repository key, there's many different formats this could exist as.

To ensure we support any valid format for a repository, I've moved this parameter away from the custom regex (there is still some custom regex to validate characters used and length limits, as those aren't present in the upstream module) to instead use parse-github-url and validate what that module says are the owner and repo from the provided URL.

Additionally, with this change I've ensured the publish endpoint can support any valid repository as well with the same module.