Allow URLs with custom protocols in links
Suggested merge commit message (convention)
Feature (link): Added allowedProtocols property in the Link config so that the list of accepted URL protocols can be modified.
Other (link): Added sftp, tel and sms to the default allowed URL protocols.
Closes #14304.
Additional information
I'm unsure which is better: whether the allowedProtocols should override the default protocols list or merge with it, when set.
Please also keep in mind that while the new url matching regex passes all of the existing test cases, enhances and fixes some edge cases, it is still an open proposition.
One missed and just spotted: file: protocol, I think it should be also the default.
One missed and just spotted:
file:protocol, I think it should be also the default.
It's important for sure (#8248), but considering that our editor is mostly used as a web editor in (shared) apps, I doubt linking to specific local files should be the default.
What's done post review:
- removed enum of common protocols
- added tests requested
@DawidKossowski To reply to general points raised:
- to be precise, I've added the description on the
allowedProtocolsfor API docs, so this is not quite true, what you mean are the guides/feature docs, from that I'm getting definite feeling that all of the things config-related require a section in docs, will keep that in mind onwards, - This is not really helpful feedback, in terms, I'm not sure what would you expect to be added, besides a junk invalid URL examples (one added), probably the fact that I've touched upon this thing makes you demand writing even more erroring tests, however up to this point we were fine with the current set (in safe url checking at least). I can either: a) expand on it and look for the top problematic URLs, b) discard this and shelve this off to another time, another issue.
- right, done, I'm not sure why I omitted it, perhaps I was looking into another set of changes and overlooked that. added
- You wrote that this is not true, but it actually is. Just for clarification, when I say 'docs,' I'm referring to user guides rather than API documentation, which are available here: https://ckeditor.com/docs/ckeditor5/latest/features/link.html
- I meant the different incorrect cases combined with the new config option.
@DawidKossowski Docs subsection added, and I'll just once more point to the discussion about changing regex, that I don't wan't to potentially waste more time, so waiting on some decisions here about whether we conduct security tests (so I shall consult right people for this) or do we put this away now and perhaps open a new ticket to improve the regex?