@cocreate/file-server 1.0.14 → 1.0.15

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.0.15](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.14...v1.0.15) (2022-12-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * console.logs ([e73293f](https://github.com/CoCreate-app/CoCreate-file-server/commit/e73293fbb50330760a42250b773581527e870bd3))
7
+
1
8
  ## [1.0.14](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.13...v1.0.14) (2022-12-05)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file-server",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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
@@ -87,29 +87,31 @@ class CoCreateFileSystem {
87
87
  res.send('could not find src');
88
88
  }
89
89
 
90
- let content_type = file['content_type'] || mime.lookup(url) || 'text/html';
90
+ let contentType = file['content-type'] || mime.lookup(url) || 'text/html';
91
91
 
92
- if (content_type.startsWith('image/') || content_type.startsWith('audio/') || content_type.startsWith('video/')) {
92
+ if (contentType.startsWith('image/') || contentType.startsWith('audio/') || contentType.startsWith('video/')) {
93
93
  var base64Data = src.replace(/^data:image\/(png|jpeg|jpg);base64,/, '');
94
94
  let file = Buffer.from(base64Data, 'base64');
95
95
  res.writeHead(200, {
96
- 'Content-Type': content_type,
96
+ 'Content-Type': contentType,
97
97
  'Content-Length': file.length
98
98
  });
99
99
  res.send(file);
100
- } else if (content_type === 'text/html') {
100
+ } else if (contentType === 'text/html') {
101
101
  try {
102
+ console.log('html src', src)
102
103
  let html = await render.HTML(src, organization_id);
104
+ console.log('returned html', html)
103
105
  if (html)
104
106
  src = html
105
107
  }
106
108
  catch (err) {
107
109
  console.warn('server-render: ' + err.message)
108
110
  }
109
- res.type(content_type);
111
+ res.type(contentType);
110
112
  res.send(src)
111
113
  } else {
112
- res.type(content_type);
114
+ res.type(contentType);
113
115
  res.send(src);
114
116
  }
115
117