| 91 | let had_explicit_protocol = false; |
| 92 | |
| 93 | const cleanUpProtocol = (potential_protocol) => { |
| 94 | had_explicit_protocol = true; |
| 95 | protocol = potential_protocol.toLowerCase(); |
| 96 | |
| 97 | if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { |
| 98 | // The identified protocol is not in the allowed list. |
| 99 | return false; |
| 100 | } |
| 101 | |
| 102 | // Remove the protocol from the URL string. |
| 103 | return url.substring(protocol_match[0].length); |
| 104 | }; |
| 105 | |
| 106 | if (protocol_match) { |
| 107 | const potential_protocol = protocol_match[1]; |