Skip to content

Commit d50c56f

Browse files
ianldgsFrozenPandaz
authored andcommitted
fix(core): do not follow symlinks when creating remote cache tarball (#31138)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior Symlinks in the remote cache tarball are "followed". That modifies the output of Next.js projects using pnpm, causing a restored cache not to work in production. ## Expected Behavior Symlinks are added to the tarball, instead of being followed. I.e. the cache output is not modified. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Should fix #31085. (cherry picked from commit cbb2619)
1 parent aabb3c7 commit d50c56f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/nx/src/native/cache/http_remote_cache.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ impl HttpRemoteCache {
109109
let tar_gz: Vec<u8> = Vec::new();
110110
let enc = flate2::write::GzEncoder::new(tar_gz, Compression::default());
111111
let mut archive = Builder::new(enc);
112+
archive.follow_symlinks(false);
112113
trace!("Created tar file for writing");
113114

114115
let cache_path = Path::new(&cache_directory);

0 commit comments

Comments
 (0)