Skip to content

Commit

Permalink
fix: Fixed missing removal of symlinks when the target path was delet…
Browse files Browse the repository at this point in the history
…ed (closes #1042)
  • Loading branch information
jrebmann committed Dec 14, 2020
1 parent f318bb5 commit ebfce1a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,15 @@ _remove(directory, item, isDirectory) {
const wasTracked = parent.has(item);
parent.remove(item);

// Fixes issue #1042 -> Relative paths were detected and added as symlinks
// (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612),
// but never removed from the map in case the path was deleted.
// This leads to an incorrect state if the path was recreated:
// https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553
if (this._symlinkPaths.has(fullPath)) {
this._symlinkPaths.delete(fullPath);
}

// If we wait for this file to be fully written, cancel the wait.
let relPath = path;
if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path);
Expand Down

0 comments on commit ebfce1a

Please sign in to comment.