@cocreate/file 1.8.0 → 1.9.1

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.9.1](https://github.com/CoCreate-app/CoCreate-file/compare/v1.9.0...v1.9.1) (2023-10-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * svg bug ([a29f6f0](https://github.com/CoCreate-app/CoCreate-file/commit/a29f6f0ec0ac71d79f86f7472e6f5a7ee86c8fab))
7
+
8
+ # [1.9.0](https://github.com/CoCreate-app/CoCreate-file/compare/v1.8.0...v1.9.0) (2023-09-19)
9
+
10
+
11
+ ### Features
12
+
13
+ * Update CoCreate dependencies to their latest versions ([90ea9c8](https://github.com/CoCreate-app/CoCreate-file/commit/90ea9c8eac20c919f2910817b79692551de80e36))
14
+
1
15
  # [1.8.0](https://github.com/CoCreate-app/CoCreate-file/compare/v1.7.3...v1.8.0) (2023-09-19)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
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",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "@cocreate/actions": "^1.11.2",
63
63
  "@cocreate/config": "^1.5.2",
64
- "@cocreate/render": "^1.27.3",
64
+ "@cocreate/render": "^1.28.0",
65
65
  "@cocreate/utils": "^1.24.2"
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: '$or' }]
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
- console.log(...errorLog)
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 (/^(image|audio|video)\/[-+.\w]+/.test(mimeType))
300
- readType = 'base64'
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