Skip to content

Commit

Permalink
Merge pull request #70 from fulldecent/fix/github-pages-template-fals…
Browse files Browse the repository at this point in the history
…e-broken-links#62

github pages template updated curl to fix false broken links.
  • Loading branch information
Raza403 committed Mar 20, 2024
2 parents 60db160 + 1fa8fa6 commit 4f73ce2
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 4f73ce2

Please sign in to comment.