Skip to content

Commit d53fe8a

Browse files
committed
fix: replace valideUrl with urlObject for URL handling consistency
1 parent d538d82 commit d53fe8a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/server.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class CoCreateLazyLoader {
4747
async request(req, res) {
4848
try {
4949
// TODO: track usage
50-
const valideUrl = new URL(`http://${req.headers.host}${req.url}`);
51-
const hostname = valideUrl.hostname;
50+
const urlObject = new URL(`http://${req.headers.host}${req.url}`);
51+
const hostname = urlObject.hostname;
5252
let organization;
5353

5454
try {
@@ -61,19 +61,19 @@ class CoCreateLazyLoader {
6161
res,
6262
this.crud,
6363
organization,
64-
valideUrl
64+
urlObject
6565
);
6666
}
6767

68-
if (valideUrl.pathname.startsWith("/webhooks/")) {
68+
if (urlObject.pathname.startsWith("/webhooks/")) {
6969
let name = req.url.split("/")[2]; // Assuming URL structure is /webhooks/name/...
7070
if (this.modules[name]) {
7171
this.executeScriptWithTimeout(name, {
7272
req,
7373
res,
7474
host: hostname,
7575
organization,
76-
valideUrl,
76+
urlObject,
7777
organization_id: organization._id
7878
});
7979
} else {
@@ -82,7 +82,7 @@ class CoCreateLazyLoader {
8282
res.end(JSON.stringify({ error: "Not found" }));
8383
}
8484
} else {
85-
this.files.send(req, res, this.crud, organization, valideUrl);
85+
this.files.send(req, res, this.crud, organization, urlObject);
8686
}
8787
} catch (error) {
8888
res.writeHead(400, { "Content-Type": "text/plain" });

0 commit comments

Comments
 (0)