@unchainedshop/file-upload 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { sha1, slugify } from '@unchainedshop/utils';
|
|
2
|
-
import baseX from 'base-x';
|
|
3
|
-
const b62 = baseX('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|
4
2
|
export default async function buildHashedFilename(directoryName, fileName, expiryDate) {
|
|
5
3
|
const hashed = await sha1(`${directoryName}${fileName}${expiryDate.getTime()}`);
|
|
6
4
|
const splittedFilename = fileName.split('.');
|
|
@@ -9,6 +7,6 @@ export default async function buildHashedFilename(directoryName, fileName, expir
|
|
|
9
7
|
const slugifiedFilenameWithExtension = [slugify(fileNameWithoutExtension), ext]
|
|
10
8
|
.filter(Boolean)
|
|
11
9
|
.join('.');
|
|
12
|
-
const
|
|
13
|
-
return `${
|
|
10
|
+
const base64url = Buffer.from(hashed).toString('base64url');
|
|
11
|
+
return `${base64url}.${slugifiedFilenameWithExtension}`;
|
|
14
12
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/file-upload",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"main": "lib/file-upload-index.js",
|
|
5
5
|
"types": "lib/file-upload-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"scripts": {
|
|
8
9
|
"clean": "tsc -b --clean",
|
|
9
10
|
"build": "tsc -b",
|
|
@@ -33,9 +34,8 @@
|
|
|
33
34
|
},
|
|
34
35
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@unchainedshop/logger": "^4.
|
|
37
|
-
"@unchainedshop/utils": "^4.
|
|
38
|
-
"base-x": "^5.0.1"
|
|
37
|
+
"@unchainedshop/logger": "^4.5.0",
|
|
38
|
+
"@unchainedshop/utils": "^4.5.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^25.0.0",
|