@cocreate/file-server 1.0.15 → 1.0.16
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.16](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.15...v1.0.16) (2022-12-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* testing ([7631e2d](https://github.com/CoCreate-app/CoCreate-file-server/commit/7631e2de7cb8b617c4abb1f916603f3496fac453))
|
|
7
|
+
|
|
1
8
|
## [1.0.15](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.0.14...v1.0.15) (2022-12-05)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -68,7 +68,8 @@ class CoCreateFileSystem {
|
|
|
68
68
|
file = file.document[0]
|
|
69
69
|
if (!file['public'] || file['public'] === "false")
|
|
70
70
|
return res.status(404).send(`access not allowed`);
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
console.log('file found', url)
|
|
72
73
|
let src;
|
|
73
74
|
if (file['src'])
|
|
74
75
|
src = file['src'];
|
|
@@ -88,7 +89,8 @@ class CoCreateFileSystem {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
let contentType = file['content-type'] || mime.lookup(url) || 'text/html';
|
|
91
|
-
|
|
92
|
+
console.log('src', contentType)
|
|
93
|
+
|
|
92
94
|
if (contentType.startsWith('image/') || contentType.startsWith('audio/') || contentType.startsWith('video/')) {
|
|
93
95
|
var base64Data = src.replace(/^data:image\/(png|jpeg|jpg);base64,/, '');
|
|
94
96
|
let file = Buffer.from(base64Data, 'base64');
|
|
@@ -99,17 +101,17 @@ class CoCreateFileSystem {
|
|
|
99
101
|
res.send(file);
|
|
100
102
|
} else if (contentType === 'text/html') {
|
|
101
103
|
try {
|
|
102
|
-
console.log('html src', src)
|
|
103
104
|
let html = await render.HTML(src, organization_id);
|
|
104
|
-
console.log('returned html', html)
|
|
105
105
|
if (html)
|
|
106
106
|
src = html
|
|
107
107
|
}
|
|
108
108
|
catch (err) {
|
|
109
109
|
console.warn('server-render: ' + err.message)
|
|
110
|
+
} finally {
|
|
111
|
+
console.log('returned html')
|
|
112
|
+
res.type(contentType);
|
|
113
|
+
res.send(src)
|
|
110
114
|
}
|
|
111
|
-
res.type(contentType);
|
|
112
|
-
res.send(src)
|
|
113
115
|
} else {
|
|
114
116
|
res.type(contentType);
|
|
115
117
|
res.send(src);
|