Upgrade Katex to v0.16.10
This commit is contained in:
27
paige/node_modules/katex/src/utils.js
generated
vendored
27
paige/node_modules/katex/src/utils.js
generated
vendored
@@ -93,11 +93,30 @@ export const assert = function<T>(value: ?T): T {
|
||||
|
||||
/**
|
||||
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
||||
* protocol (and thus is relative).
|
||||
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
||||
* (so should be outright rejected).
|
||||
*/
|
||||
export const protocolFromUrl = function(url: string): string {
|
||||
const protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url);
|
||||
return (protocol != null ? protocol[1] : "_relative");
|
||||
export const protocolFromUrl = function(url: string): string | null {
|
||||
// Check for possible leading protocol.
|
||||
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
||||
// (U+20) or C0 control (U+00-U+1F) characters.
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i
|
||||
.exec(url);
|
||||
if (!protocol) {
|
||||
return "_relative";
|
||||
}
|
||||
// Reject weird colons
|
||||
if (protocol[2] !== ":") {
|
||||
return null;
|
||||
}
|
||||
// Reject invalid characters in scheme according to
|
||||
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
|
||||
if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
|
||||
return null;
|
||||
}
|
||||
// Lowercase the protocol
|
||||
return protocol[1].toLowerCase();
|
||||
};
|
||||
|
||||
export default {
|
||||
|
Reference in New Issue
Block a user