(value: string)
| 294 | } |
| 295 | |
| 296 | function isSafeHttpUrl(value: string): boolean { |
| 297 | if (hasControlChars(value)) return false; |
| 298 | try { |
| 299 | const url = new URL(value); |
| 300 | return url.protocol === 'https:' || url.protocol === 'http:'; |
| 301 | } catch { |
| 302 | return false; |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | function hasControlChars(value: string): boolean { |
| 307 | for (const char of value) { |
no test coverage detected