Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vcheckzen authored Dec 7, 2024
1 parent 29872a7 commit 8a50d0e
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions back-end-cf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,13 @@ async function fetchAccessToken() {
}

async function authenticate(path, passwd) {
const pwFileRes = await downloadFile(
const pwFileContent = await downloadFile(
`${path}/${PASSWD_FILENAME}`,
null,
true
);
let pwFileContent;
switch (pwFileRes.status) {
case 302:
pwFileContent = pwFileRes.text();
break;
case 401:
pwFileContent = await getContent(pwFileRes.url);
break;
default:
pwFileContent = undefined;
break;
}
)
.then((resp) => (resp.status === 401 ? cacheFetch(resp.url) : resp))
.then((resp) => (resp.status === 404 ? undefined : resp.text()));

if (pwFileContent) {
if (passwd !== pwFileContent) {
Expand Down

0 comments on commit 8a50d0e

Please sign in to comment.