Skip to content

Commit

Permalink
[wopi] Fix wopi url for pdf checker without jwt token; For bug 62643
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Mar 4, 2024
1 parent 05fa9a4 commit 1d2fbb3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/api/wopi/editor-wopi.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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) %>;
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 1d2fbb3

Please sign in to comment.