MCPcopy Create free account
hub / github.com/github/gh-aw / isHtmlContent

Function isHtmlContent

actions/setup/js/error_helpers.cjs:11–13  ·  view source on GitHub ↗

* Detect whether a string looks like an HTML page rather than a plain error message. * Used to sanitize GitHub's "Unicorn" / gateway error HTML responses so they don't * pollute CI logs with hundreds of lines of markup. * * @param {string} str - The string to inspect * @returns {boolean} True w

(str)

Source from the content-addressed store, hash-verified

9 * @returns {boolean} True when the string appears to be an HTML document
10 */
11function isHtmlContent(str) {
12 return /^\s*<!DOCTYPE\s/i.test(str) || /^\s*<html[\s>]/i.test(str);
13}
14
15/**
16 * Safely extract an error message from an unknown error value.

Callers 2

getErrorMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected