spatie / url

Parse, build and manipulate URL's

Home Page:https://spatie.be/open-source?search=&sort=-downloads

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to configure `VALID_SCHEMES` or disable scheme validation

bmitch opened this issue · comments

Really enjoy using this package and been using it for a number of projects.

Ran into a situation where some of the URLs I need to work with have a scheme of applewebdata.

This fails when I attempt to make a URL with this scheme since the only schemes allowed are:

    const VALID_SCHEMES = ['http', 'https', 'mailto'];

However, there are many more valid schemes than those 3:

https://tools.ietf.org/html/rfc3986#section-3.1

I'd like to make a PR to solve this situation but wanted to run this by you guys to discuss what the best solution would be before I do any coding. Some ideas are:

  • A: Removing the scheme validation altogether.
  • B: Or maybe make it something that can be turned off.
  • C: Adjusting the scheme validation to use the pattern describes in that RFC.

Thanks very much.

I'd like to go for option B and D. D = making the schemes configurable.

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

Have the same issue. I had exception in case of android-app://... that is default referrer in Android WebView. Make please some method like isUrlValid that return bool or a way to disable checking schemes.