change dir resolver to include virtual path (#2259)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2023-11-02 08:20:00 -04:00
committed by GitHub
parent 26cdbfc299
commit 6c41f15975
8 changed files with 27 additions and 35 deletions
@@ -261,13 +261,14 @@ func (u UnindexedDirectory) Write(location file.Location, reader io.Reader) erro
func (u UnindexedDirectory) newLocation(filePath string, resolveLinks bool) *file.Location {
filePath = path.Clean(filePath)
virtualPath := ""
virtualPath := filePath
realPath := filePath
if resolveLinks {
paths := u.resolveLinks(filePath)
if len(paths) > 1 {
realPath = paths[len(paths)-1]
// TODO: this is not quite correct, as the equivalent of os.EvalSymlinks needs to be done (in the context of afero)
if realPath != path.Clean(filePath) {
virtualPath = paths[0]
}