Skip to content

Commit

Permalink
fix: can nolt preview a file when its title contains a % - EXO-65642 (#…
Browse files Browse the repository at this point in the history
…204)

Handle correctly the exception of decoding the title when it does contain the character
  • Loading branch information
ahamdi committed Aug 1, 2023
1 parent 704e104 commit 968b044
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions webapp/src/main/webapp/js/onlyoffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,13 @@
createViewer(config).done(function(localConfig) {
if (localConfig) {
currentConfig = localConfig;
currentConfig.document.title = decodeURI(decodeURI(currentConfig.document.title));
currentConfig.document.title = currentConfig.document.title;
try {
currentConfig.document.title = decodeURI(decodeURI(currentConfig.document.title));
} catch (error) {
//No problem, we can use the title as is, it does not need to be decoded and it contains a % character
}

$(function() {
try {
new DocsAPI.DocEditor("onlyoffice", localConfig);
Expand Down Expand Up @@ -1088,8 +1094,17 @@
};

this.initBar = function(config) {
config.editorPage.displayPath = decodeURI(config.editorPage.displayPath);
config.path = decodeURI(config.path);
config.editorPage.displayPath = config.editorPage.displayPath;
try {
config.editorPage.displayPath = decodeURI(config.editorPage.displayPath);
} catch (error) {
//No problem, we can use the title as is, it does not need to be decoded and it contains a % character
}
try {
config.path = decodeURI(config.path);
} catch (error) {
//No problem, we can use the title as is, it does not need to be decoded and it contains a % character
}
var drive = config.editorPage.drive;
if (drive === null) {
UI.showError(message("ErrorTitle"), message("ErrorNameDriveNull"));
Expand Down Expand Up @@ -1470,4 +1485,4 @@
}
});
return editor;
})($, cCometD, Redux, editorbuttons, editorsupport);
})($, cCometD, Redux, editorbuttons, editorsupport);

0 comments on commit 968b044

Please sign in to comment.