@browserless.io/browserless 2.38.0 → 2.38.1
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/build/browsers/index.js
CHANGED
|
@@ -299,7 +299,12 @@ export class BrowserManager {
|
|
|
299
299
|
// Handle browser re-connects here
|
|
300
300
|
if (this.reconnectionPatterns.some((p) => req.parsed.pathname.includes(p))) {
|
|
301
301
|
const sessions = Array.from(this.browsers);
|
|
302
|
-
const
|
|
302
|
+
const pathParts = req.parsed.pathname.split('/');
|
|
303
|
+
// The last part of the path is the browser ID, or the second last part in case the path ends with "/"
|
|
304
|
+
const id = pathParts.pop() || pathParts.pop();
|
|
305
|
+
if (!id) {
|
|
306
|
+
throw new NotFound(`Couldn't locate browser ID from path "${req.parsed.pathname}"`);
|
|
307
|
+
}
|
|
303
308
|
const found = sessions.find(([b]) => b.wsEndpoint()?.includes(id));
|
|
304
309
|
if (found) {
|
|
305
310
|
const [browser, session] = found;
|
package/package.json
CHANGED
package/src/browsers/index.ts
CHANGED
|
@@ -466,7 +466,14 @@ export class BrowserManager {
|
|
|
466
466
|
this.reconnectionPatterns.some((p) => req.parsed.pathname.includes(p))
|
|
467
467
|
) {
|
|
468
468
|
const sessions = Array.from(this.browsers);
|
|
469
|
-
const
|
|
469
|
+
const pathParts = req.parsed.pathname.split('/');
|
|
470
|
+
// The last part of the path is the browser ID, or the second last part in case the path ends with "/"
|
|
471
|
+
const id = pathParts.pop() as string || pathParts.pop() as string;
|
|
472
|
+
if (!id) {
|
|
473
|
+
throw new NotFound(
|
|
474
|
+
`Couldn't locate browser ID from path "${req.parsed.pathname}"`,
|
|
475
|
+
);
|
|
476
|
+
}
|
|
470
477
|
const found = sessions.find(([b]) => b.wsEndpoint()?.includes(id));
|
|
471
478
|
|
|
472
479
|
if (found) {
|
package/static/docs/swagger.json
CHANGED