Skip to content

Commit

Permalink
FileSystem: Fix FS path comparison, write from stream to new path only
Browse files Browse the repository at this point in the history
* Always resolve fsBasePath to absolute path for later comparison
* Always transform stream into buffer if write path equals source path
  • Loading branch information
RandomByte committed Apr 19, 2022
1 parent 1ec5633 commit d437b7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/adapters/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FileSystem extends AbstractAdapter {
*/
constructor({virBasePath, project, fsBasePath, excludes}) {
super({virBasePath, project, excludes});
this._fsBasePath = fsBasePath;
this._fsBasePath = path.resolve(fsBasePath);
}

/**
Expand Down Expand Up @@ -240,7 +240,7 @@ class FileSystem extends AbstractAdapter {
return new Promise((resolve, reject) => {
let contentStream;

if (drain || readOnly) {
if ((drain || readOnly) && resourceSource.fsPath !== fsPath) {
// Stream will be drained
contentStream = resource.getStream();

Expand Down

0 comments on commit d437b7a

Please sign in to comment.