Skip to content

Commit

Permalink
Fix bug in create-remix git repo path collisions (#7194)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Aug 21, 2023
1 parent 3447963 commit 0e1e2c3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/create-remix/copy-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,15 @@ async function downloadAndExtractTarball(
header.name = header.name.replace(`${originalDirName}/`, "");

if (filePath) {
if (header.name.startsWith(filePath)) {
// Include trailing slash on startsWith when filePath doesn't include
// it so something like `templates/remix` doesn't inadvertently
// include `templates/remix-javascript/*` files
if (
(filePath.endsWith(path.posix.sep) &&
header.name.startsWith(filePath)) ||
(!filePath.endsWith(path.posix.sep) &&
header.name.startsWith(filePath + path.posix.sep))
) {
filePathHasFiles = true;
header.name = header.name.replace(filePath, "");
} else {
Expand Down

0 comments on commit 0e1e2c3

Please sign in to comment.