Skip to content

Commit

Permalink
[MM-46] Fix polish characters encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Skwara committed Jul 15, 2023
1 parent 36ba273 commit 0eb714a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"multer-s3": "^3.0.1",
"pkg": "^5.8.0",
"pkg-api": "^1.0.0",
"remove-accents": "^0.4.2",
"validator": "^13.7.0",
"xss-clean": "^0.1.1"
},
Expand Down
5 changes: 5 additions & 0 deletions src/utils/parseToUTF8.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Taken from https://github.com/expressjs/multer/issues/1104#issuecomment-1152987772
// TODO Maybe this PR will fix the multer issue: https://github.com/expressjs/multer/pull/1210

export default (name: string): string =>
Buffer.from(name, 'latin1').toString('utf8');
4 changes: 2 additions & 2 deletions src/utils/prepareName.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import removeAccents from 'remove-accents';
import parseToUTF8 from './parseToUTF8';

export default (name: string) => removeAccents(name);
export default (name: string): string => parseToUTF8(name);

0 comments on commit 0eb714a

Please sign in to comment.