Skip to content

Commit d0a956d

Browse files
committed
fix: handing condition if organization id not found
1 parent 1f28b72 commit d0a956d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ class CoCreateFileSystem {
4242
}
4343
}
4444

45+
let organization_id
4546
if (!organization || organization.error) {
4647
let hostNotFound = await getDefaultFile('/hostNotFound.html')
4748
return sendResponse(hostNotFound.object[0].src, 404, { 'Content-Type': 'text/html' })
4849
}
4950

50-
const organization_id = organization._id
51+
organization_id = organization._id
5152
data.organization_id = organization_id
5253

5354
res.setHeader('organization', organization_id)
@@ -176,11 +177,12 @@ class CoCreateFileSystem {
176177
src = JSON.stringify(src);
177178
}
178179

179-
crud.wsManager.emit("setBandwidth", {
180-
type: 'out',
181-
data: src,
182-
organization_id
183-
});
180+
if (organization_id)
181+
crud.wsManager.emit("setBandwidth", {
182+
type: 'out',
183+
data: src,
184+
organization_id
185+
});
184186
res.writeHead(statusCode, headers);
185187
return res.end(src);
186188
} catch (error) {

0 commit comments

Comments
 (0)