Skip to content

Commit

Permalink
Merge pull request cthackers#499 from skoniks/master
Browse files Browse the repository at this point in the history
Fix utils canonical to valid posix
  • Loading branch information
cthackers authored Jun 5, 2024
2 parents 8bc4111 + 233f829 commit 28fdcdf
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 28fdcdf

Please sign in to comment.