gulpjs / vinyl

Virtual file format.
MIT License
1.28k stars 107 forks source link

Behavior of `file.base` when set to `file.cwd`? #129

Closed phated closed 7 years ago

phated commented 7 years ago

I just ran into this while working on vinyl-sourcemap: if someone does file.base = file.cwd, what should the resulting behavior be? Currently we don't do anything due to the check at https://github.com/gulpjs/vinyl/blob/master/index.js#L215

cc @darsain

darsain commented 7 years ago

If base after normalization equals cwd, it should result in delete this._base; so the getter can default to this._cwd. Not doing anything there is definitely a bug.

phated commented 7 years ago

@darsain cool, thanks for looking at that. It felt like a bug but I wasn't sure.