[wopi] Fix wopi url for pdf checker without jwt token; For bug 62643

This commit is contained in:
Sergey Konovalov
2024-03-05 02:00:06 +03:00
parent 05fa9a4cc1
commit 1d2fbb3710

View File

@ -247,6 +247,19 @@ div {
innerAlert(event.data);
};
var getWopiFileUrl = function(fileInfo, userAuth) {
let url;
if (fileInfo.FileUrl) {
//Requests to the FileUrl can not be signed using proof keys. The FileUrl is used exactly as provided by the host, so it does not necessarily include the access token, which is required to construct the expected proof.
url = fileInfo.FileUrl;
} else if (fileInfo.TemplateSource) {
url = fileInfo.TemplateSource;
} else if (userAuth) {
url = userAuth.wopiSrc + "/contents?access_token=" + userAuth.access_token;
}
return url;
}
var connectEditor = function () {
fileInfo = <%- JSON.stringify(fileInfo) %>;
@ -280,7 +293,7 @@ div {
"token": token,
"document": {
"title": fileInfo.BreadcrumbDocName || fileInfo.BaseFileName,
"url": userAuth.wopiSrc,
"url": getWopiFileUrl(fileInfo, userAuth),
"fileType": fileType,
"key": key,
"info": {