From e16340261a6af367ef9633cf07ff7454c2b5d64b Mon Sep 17 00:00:00 2001 From: Emmanuel Schanzer Date: Tue, 21 Mar 2023 14:20:54 -0400 Subject: [PATCH] [lib] when checking for newer URLs, return false if the result is anything besides http.status=200 --- lib/bootstraplesson.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bootstraplesson.js b/lib/bootstraplesson.js index aeef4d30b5b..02839214e97 100644 --- a/lib/bootstraplesson.js +++ b/lib/bootstraplesson.js @@ -1,11 +1,12 @@ /******************************************* * IDENTIFY OLD VERSIONS *******************************************/ - function UrlExists(url) { + function UrlExists(url) { var http = new XMLHttpRequest(); http.open('HEAD', url, false); // TODO: change this to 'true' and use a promise to render the out of date banner http.send(); - return (http.status !== 404) + console.log('checking for', url, 'status is', http.status) + return (http.status == 200) } function isNewest() { @@ -34,6 +35,7 @@ } } + /******************************************* * ATTACH OPEN/CLOSE EVENTS TO LESSON SIDEBAR *******************************************/