Skip to content

Commit

Permalink
github pages template updated curl to fix false broken links. This PR f…
Browse files Browse the repository at this point in the history
…ixes #62
  • Loading branch information
Raza403 committed Mar 20, 2024
1 parent 60db160 commit 1fa8fa6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/plugin.html-validate.external-links.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ export default class ExternalLinksRule extends Rule {
}

try {
const result = execSync(`curl --head --silent --fail --max-time ${TIMEOUT_SECONDS} --location "${url}"`);
const result = execSync(`curl --head --silent --fail --max-time ${TIMEOUT_SECONDS} --location \
--user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.9999.999 Safari/537.36" \
--header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
"${url}"`);
// Success: link is good
this.db.prepare("REPLACE INTO urls (url, found, time) VALUES (?, 1, unixepoch())").run(url);
} catch (error) {
Expand Down

0 comments on commit 1fa8fa6

Please sign in to comment.