@cocreate/file-server 1.16.1 → 1.16.2
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 +8 -0
- package/package.json +1 -1
- package/src/index.js +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.16.2](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.16.1...v1.16.2) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* return if organization.error ([b6425eb](https://github.com/CoCreate-app/CoCreate-file-server/commit/b6425eb780f2a031a3e68bd7f61226774d65d966))
|
|
7
|
+
* update to support new query system ([e46947c](https://github.com/CoCreate-app/CoCreate-file-server/commit/e46947cb3c6ee63975ae6c696e5ac5f6ef6e5cb6))
|
|
8
|
+
|
|
1
9
|
## [1.16.1](https://github.com/CoCreate-app/CoCreate-file-server/compare/v1.16.0...v1.16.1) (2024-01-11)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ class CoCreateFileSystem {
|
|
|
27
27
|
|
|
28
28
|
async send(req, res, crud, organization, valideUrl) {
|
|
29
29
|
try {
|
|
30
|
-
if (!organization) {
|
|
30
|
+
if (!organization || organization.error) {
|
|
31
31
|
let hostNotFound = await getDefaultFile('/hostNotFound.html')
|
|
32
32
|
return sendResponse(hostNotFound.object[0].src, 404, { 'Content-Type': 'text/html' })
|
|
33
33
|
}
|
|
@@ -81,11 +81,10 @@ class CoCreateFileSystem {
|
|
|
81
81
|
host: hostname,
|
|
82
82
|
array: 'files',
|
|
83
83
|
$filter: {
|
|
84
|
-
query:
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
],
|
|
84
|
+
query: {
|
|
85
|
+
host: { $in: [hostname, '*'] },
|
|
86
|
+
$or: [{ pathname }, { pathname: wildcard }]
|
|
87
|
+
},
|
|
89
88
|
limit: 1
|
|
90
89
|
},
|
|
91
90
|
organization_id
|
|
@@ -164,7 +163,7 @@ class CoCreateFileSystem {
|
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
async function getDefaultFile(fileName) {
|
|
167
|
-
data.$filter.query[
|
|
166
|
+
data.$filter.query.$or[0].pathname = fileName
|
|
168
167
|
let defaultFile
|
|
169
168
|
if (fileName !== '/hostNotFound.html')
|
|
170
169
|
defaultFile = await crud.send(data);
|
|
@@ -172,11 +171,11 @@ class CoCreateFileSystem {
|
|
|
172
171
|
if (defaultFile && defaultFile.object && defaultFile.object[0] && defaultFile.object[0].src) {
|
|
173
172
|
return defaultFile
|
|
174
173
|
} else {
|
|
175
|
-
data.$filter.query
|
|
174
|
+
data.$filter.query.host.$in = ['*']
|
|
176
175
|
data.organization_id = process.env.organization_id
|
|
177
176
|
|
|
178
177
|
if (fileName.startsWith('/admin'))
|
|
179
|
-
data.$filter.query[
|
|
178
|
+
data.$filter.query.$or[0].pathname = '/superadmin' + fileName.replace('/admin', '')
|
|
180
179
|
|
|
181
180
|
defaultFile = await crud.send(data)
|
|
182
181
|
|