Skip to content

Commit

Permalink
nodejs: decode filename from utf7 in "save as" process (Fix Bug 69827)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Sep 5, 2024
1 parent 1e6465a commit 194ad60
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
4 changes: 4 additions & 0 deletions 3rd-Party.license
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ urllib - Request HTTP URLs in a complex world — basic and digest authen
License: MIT
License File: urllib.license

utf7 - Encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. (https://github.com/kkaefer/utf7/blob/master/LICENSE)
License: MIT
License File: utf7.license


web/documentserver-example/php

Expand Down
4 changes: 4 additions & 0 deletions web/documentserver-example/nodejs/3rd-Party.license
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ License File: serve-favicon.license
urllib - Request HTTP URLs in a complex world — basic and digest authentication, redirections, cookies, timeout and more. (https://github.com/node-modules/urllib/blob/master/LICENSE)
License: MIT
License File: urllib.license

utf7 - Encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. (https://github.com/kkaefer/utf7/blob/master/LICENSE)
License: MIT
License File: utf7.license
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const fileUtility = require('../fileUtility');
const lockManager = require('./lockManager');
const users = require('../users');
const DocManager = require('../docManager');
const utf7 = require('utf7');

Check failure on line 27 in web/documentserver-example/nodejs/helpers/wopi/filesController.js

View workflow job for this annotation

GitHub Actions / Lint

`utf7` import should occur before import of `./request`

// return lock mismatch
const returnLockMismatch = function returnLockMismatch(res, lock, reason) {
Expand Down Expand Up @@ -228,7 +229,7 @@ const putRelativeFile = function putRelativeFile(wopi, req, res, userHost) {
}
} else {
filename = req.headers[reqConsts.requestHeaders.SuggestedTarget.toLowerCase()]; // we can modify this filename

filename = utf7.decode(filename);
if (filename.startsWith('.')) { // check if extension
filename = fileUtility.getFileName(wopi.id, true) + filename; // get original filename with new extension
}
Expand Down
4 changes: 4 additions & 0 deletions web/documentserver-example/nodejs/licenses/3rd-Party.license
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ License File: serve-favicon.license
urllib - Request HTTP URLs in a complex world — basic and digest authentication, redirections, cookies, timeout and more. (https://github.com/node-modules/urllib/blob/master/LICENSE)
License: MIT
License File: urllib.license

utf7 - Encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. (https://github.com/kkaefer/utf7/blob/master/LICENSE)
License: MIT
License File: utf7.license
19 changes: 19 additions & 0 deletions web/documentserver-example/nodejs/licenses/utf7.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2010-2011 Konstantin Käfer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
19 changes: 18 additions & 1 deletion web/documentserver-example/nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion web/documentserver-example/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"log4js": "^6.9.1",
"mime": "^2.4.6",
"serve-favicon": "^2.5.0",
"urllib": "^2.36.1"
"urllib": "^2.36.1",
"utf7": "^1.0.2"
},
"license": "Apache",
"repository": {
Expand Down

0 comments on commit 194ad60

Please sign in to comment.