Skip to content

Commit

Permalink
Intercept login page when trying to upload to 4CAT
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Apr 3, 2023
1 parent aee69dc commit bee6d83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions popup/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,16 @@ async function button_handler(event) {
if(xhr.readyState === xhr.DONE) {
if(xhr.status === 200) {
status.innerText = 'File uploaded. Waiting for processing to finish.'
if (xhr.responseURL.indexOf('/login/') >= 0) {
is_uploading = false;
status.innerText = 'You are not logged in to this 4CAT server! Open it in a separate tab, log in and try again.'
return;
}

try {
response = JSON.parse(response);
} catch (e) {
is_uploading = false;
status.innerText = 'Error during upload: malformed response from 4CAT server.';
return;
}
Expand Down

0 comments on commit bee6d83

Please sign in to comment.