diff --git a/javascript/src/iframe/viamapi-iframe.js b/javascript/src/iframe/viamapi-iframe.js index ed9f97ddcb139e4c66a17b5625caff903e261015..3a6be2bdd6c49e5599e24ee157f744a2d2a22784 100644 --- a/javascript/src/iframe/viamapi-iframe.js +++ b/javascript/src/iframe/viamapi-iframe.js @@ -1097,7 +1097,7 @@ const connection = Penpal.connectToParent({ return response.data; }, - wopiPutFile: async (fileId, accessToken, file) => { + wopiPutFile: async (path, accessToken, file) => { const authenticationPublicKey = localStorage.getItem("authenticatedIdentity"); if ( @@ -1108,7 +1108,7 @@ const connection = Penpal.connectToParent({ return encodeResponse("400", "", "Identity not authenticated"); } - const response = await wopiAPI.putDocument(fileId, accessToken, file); + const response = await wopiAPI.putDocument(path, accessToken, file); return response.data; } } diff --git a/javascript/src/iframe/wopiapi-iframe.js b/javascript/src/iframe/wopiapi-iframe.js index 01639ea057ebcf675babe1b99d416248f05be473..c009f9ed020171a5bafc2a4ff4b97c60aff11f9f 100644 --- a/javascript/src/iframe/wopiapi-iframe.js +++ b/javascript/src/iframe/wopiapi-iframe.js @@ -19,10 +19,11 @@ WopiAPI.prototype.getPassports = function (fileID) { return axios(requestConfig); }; -WopiAPI.prototype.putDocument = function (fileId, accessToken, file) { +WopiAPI.prototype.putDocument = function (path, accessToken, file) { const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers; + path = path[0] === "/" ? path : `/${path}`; const requestConfig = { - url: `${window.WOPI_URL}files/${fileId}/contents`, + url: `${window.WOPI_URL}files${path}/contents`, method: 'POST', headers: { publicKey,