git-workspace-service 0.4.1 → 0.4.3
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/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -642,7 +642,13 @@ var WorkspaceService = class {
|
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
try {
|
|
645
|
-
await fs3__namespace.
|
|
645
|
+
const realPath = await fs3__namespace.realpath(workspace.path);
|
|
646
|
+
const realBase = await fs3__namespace.realpath(this.baseDir);
|
|
647
|
+
if (!realPath.startsWith(realBase + path__namespace.sep) && realPath !== realBase) {
|
|
648
|
+
this.log("error", { workspaceId, realPath, realBase }, "Workspace path resolves outside baseDir \u2014 refusing to delete");
|
|
649
|
+
} else {
|
|
650
|
+
await fs3__namespace.rm(workspace.path, { recursive: true, force: true });
|
|
651
|
+
}
|
|
646
652
|
} catch (error) {
|
|
647
653
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
648
654
|
this.log("warn", { workspaceId, error: errorMessage }, "Failed to remove workspace directory");
|
|
@@ -675,6 +681,7 @@ var WorkspaceService = class {
|
|
|
675
681
|
if (cloneUrl.startsWith("git@github.com:")) {
|
|
676
682
|
cloneUrl = cloneUrl.replace("git@github.com:", "https://github.com/");
|
|
677
683
|
}
|
|
684
|
+
cloneUrl = cloneUrl.replace(/\/+$/, "");
|
|
678
685
|
if (!cloneUrl.endsWith(".git")) {
|
|
679
686
|
cloneUrl = `${cloneUrl}.git`;
|
|
680
687
|
}
|
|
@@ -809,6 +816,7 @@ var WorkspaceService = class {
|
|
|
809
816
|
if (url.startsWith("git@github.com:")) {
|
|
810
817
|
url = url.replace("git@github.com:", "https://github.com/");
|
|
811
818
|
}
|
|
819
|
+
url = url.replace(/\/+$/, "");
|
|
812
820
|
if (!url.endsWith(".git")) {
|
|
813
821
|
url = `${url}.git`;
|
|
814
822
|
}
|