You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MNT-20685 commit made by @antoniojfelix introduced a bug, where a file is downloaded two times ( firstly to JS, secondly to client).
It creates 2x bigger server load and a client have to wait 2x longer. It is especially visible on the bigger files.
Proposed fix
As a fix, in the Pdfjs.js file in the downloadIfLoggedIn() function I propose to check if url contanis the "alfresco-noauth" and for the logged in validation, "/touch" API can be used.
Sample code:
downloadIfLoggedIn : function PdfJs_downloadIfLoggedIn(url)
{
// check if site is shared
// if yes, always download, no matter of the login state
if(url.includes("/alfresco-noauth/"))
{
window.open(url, "_blank");
return;
}
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (this.status === 401)
{
// user is logged out, reload should move to login page
window.location.reload();
}
else if (this.readyState == 4 && this.status == 200) {
window.open(url, "_blank");
}
};
// check if user has been logged out
request.open("GET", Alfresco.constants.PROXY_URI + "touch", true);
request.send();
}
Using the code above, there might be a problem with a 301 redirect and CORS protection (i.e. when using external auth).
Affected versions
Alfresco 7.2. and onwards.
The text was updated successfully, but these errors were encountered:
howkymike
changed the title
Shared files - double fiel download
Shared files - double file download
Dec 2, 2022
Bug description
MNT-20685 commit made by @antoniojfelix introduced a bug, where a file is downloaded two times ( firstly to JS, secondly to client).
It creates 2x bigger server load and a client have to wait 2x longer. It is especially visible on the bigger files.
Proposed fix
As a fix, in the Pdfjs.js file in the downloadIfLoggedIn() function I propose to check if url contanis the "alfresco-noauth" and for the logged in validation, "/touch" API can be used.
Sample code:
Using the code above, there might be a problem with a 301 redirect and CORS protection (i.e. when using external auth).
Affected versions
Alfresco 7.2. and onwards.
The text was updated successfully, but these errors were encountered: