@cocreate/file-server 1.16.5 → 1.16.6

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,10 @@
1
+ ## [1.16.6](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.16.5...v1.16.6) (2024-06-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * base64 test ([8dd6ffc](https://github.com/CoCreate-app/CoCreate-file-server/commit/8dd6ffc8d4a24116056ea392ae697e61bb523ed5))
7
+
1
8
  ## [1.16.5](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.16.4...v1.16.5) (2024-04-26)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file-server",
3
- "version": "1.16.5",
3
+ "version": "1.16.6",
4
4
  "description": "A simple file-server component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "file-server",
package/src/index.js CHANGED
@@ -152,9 +152,12 @@ class CoCreateFileSystem {
152
152
  }
153
153
 
154
154
  let contentType = file['content-type'] || 'text/html';
155
- if (/^[A-Za-z0-9+/]+[=]{0,2}$/.test(src)) {
155
+ // const cleanedSrc = src.replace(/\s/g, '');
156
+ if (/^data:image\/[a-zA-Z0-9+.-]+;base64,([A-Za-z0-9+/]+={0,2})$/.test(src)) {
156
157
  src = src.replace(/^data:image\/(png|jpeg|jpg);base64,/, '');
157
158
  src = Buffer.from(src, 'base64');
159
+ } else if (/^([A-Za-z0-9+/]+={0,2})$/.test(src)) {
160
+ src = Buffer.from(src, 'base64');
158
161
  } else if (contentType === 'text/html') {
159
162
  try {
160
163
  src = await this.render.HTML(src, organization_id);