@cocreate/file 1.9.0 → 1.9.2
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.
- package/CHANGELOG.md +15 -0
- package/package.json +5 -5
- package/src/server.js +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.9.2](https://github.com/CoCreate-app/CoCreate-file/compare/v1.9.1...v1.9.2) (2023-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump cocreate dependency versions ([1ff6a15](https://github.com/CoCreate-app/CoCreate-file/commit/1ff6a152bff209813f21f2ebb0a7a5ebfbc33477))
|
|
7
|
+
* bump dependencies ([2ce5dc3](https://github.com/CoCreate-app/CoCreate-file/commit/2ce5dc3c735fbf1647ed95aa04447a779211bb4f))
|
|
8
|
+
|
|
9
|
+
## [1.9.1](https://github.com/CoCreate-app/CoCreate-file/compare/v1.9.0...v1.9.1) (2023-10-09)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* svg bug ([a29f6f0](https://github.com/CoCreate-app/CoCreate-file/commit/a29f6f0ec0ac71d79f86f7472e6f5a7ee86c8fab))
|
|
15
|
+
|
|
1
16
|
# [1.9.0](https://github.com/CoCreate-app/CoCreate-file/compare/v1.8.0...v1.9.0) (2023-09-19)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/file",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "A headless file uploader that uses HTML5 attributes for customization. Allows easy upload of files to server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.11.
|
|
63
|
-
"@cocreate/config": "^1.
|
|
64
|
-
"@cocreate/render": "^1.
|
|
65
|
-
"@cocreate/utils": "^1.
|
|
62
|
+
"@cocreate/actions": "^1.11.3",
|
|
63
|
+
"@cocreate/config": "^1.6.1",
|
|
64
|
+
"@cocreate/render": "^1.28.0",
|
|
65
|
+
"@cocreate/utils": "^1.25.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/server.js
CHANGED
|
@@ -269,7 +269,7 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
|
|
|
269
269
|
|
|
270
270
|
if (!newObject.object._id)
|
|
271
271
|
newObject.$filter = {
|
|
272
|
-
query: [{ key: 'pathname', value: pathname, operator: '$
|
|
272
|
+
query: [{ key: 'pathname', value: pathname, operator: '$eq' }]
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
response = await runStore(newObject);
|
|
@@ -288,17 +288,19 @@ module.exports = async function file(CoCreateConfig, configPath, match) {
|
|
|
288
288
|
await runFiles(directory, newEntry, exclude, pathname, name)
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
if (errorLog.length)
|
|
292
|
-
|
|
291
|
+
// if (errorLog.length)
|
|
292
|
+
// console.log(...errorLog)
|
|
293
293
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
function getSource(path, mimeType) {
|
|
298
298
|
let readType = 'utf8'
|
|
299
|
-
if (
|
|
300
|
-
readType = '
|
|
301
|
-
|
|
299
|
+
if (mimeType === 'image/svg+xml') {
|
|
300
|
+
readType = 'utf8';
|
|
301
|
+
} else if (/^(image|audio|video)\/[-+.\w]+/.test(mimeType)) {
|
|
302
|
+
readType = 'base64';
|
|
303
|
+
}
|
|
302
304
|
let binary = fs.readFileSync(path);
|
|
303
305
|
let content = new Buffer.from(binary).toString(readType);
|
|
304
306
|
|