@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 +7 -0
- package/package.json +1 -1
- package/src/index.js +8 -6
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
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
|
|
90
|
+
let contentType = file['content-type'] || mime.lookup(url) || 'text/html';
|
|
91
91
|
|
|
92
|
-
if (
|
|
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':
|
|
96
|
+
'Content-Type': contentType,
|
|
97
97
|
'Content-Length': file.length
|
|
98
98
|
});
|
|
99
99
|
res.send(file);
|
|
100
|
-
} else if (
|
|
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(
|
|
111
|
+
res.type(contentType);
|
|
110
112
|
res.send(src)
|
|
111
113
|
} else {
|
|
112
|
-
res.type(
|
|
114
|
+
res.type(contentType);
|
|
113
115
|
res.send(src);
|
|
114
116
|
}
|
|
115
117
|
|