Skip to content

Commit

Permalink
Fix utils canonical to valid posix
Browse files Browse the repository at this point in the history
  • Loading branch information
skoniks committed Jun 5, 2024
1 parent 8bc4111 commit 233f829
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ describe("utils - sanitizing functions :", () => {
{ file: "./../file", result: "file" },
{ file: "../../file", result: "file" },
{ file: "../../file1/../file2", result: "file2" },
{ file: "../subfolder/file2", result: `subfolder${pth.sep}file2` },
{ file: "../subfolder2/file2", result: `subfolder2${pth.sep}file2` },
{ file: "../subfolder/file2", result: `subfolder${pth.sep}file2` },
{ file: "../../subfolder2/file2", result: `subfolder2${pth.sep}file2` }
{ file: "../subfolder/file2", result: "subfolder/file2" },
{ file: "../subfolder2/file2", result: "subfolder2/file2" },
{ file: "../subfolder/file2", result: "subfolder/file2" },
{ file: "../../subfolder2/file2", result: "subfolder2/file2" }
];

for (let test of tests) {
Expand Down
2 changes: 1 addition & 1 deletion util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Utils.canonical = function (/*string*/ path) {
if (!path) return "";
// trick normalize think path is absolute
var safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/"));
return pth.join(".", safeSuffix);
return pth.posix.join(".", safeSuffix);
};

// make abolute paths taking prefix as root folder
Expand Down

0 comments on commit 233f829

Please sign in to comment.