You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using double dots in 'from' path (eg /path/to/your/../my/files), sync-directory can have an unexpected behavior.
For example, /path/to/my/files contains a single file, myfile. Let's run sync-directory from /path/to/your/../my/files to /path/to/dest on watch mode. At launch, it creates the /path/to/dest and populates it with myfile, as expected. But when /path/to/my/files/myfile is edited, /path/to/dest is turned into a file (not a directory anymore), filled with /path/to/my/files/myfile's content. Run the same sequence again, this time with /path/to/my/files (same folder, but without the double dots), and everything works as expected. I observed this with node 14 on Windows.
I don't think it is necessary to investigate this behavior, but just conclude that double dots notation can lead to unexpected results. I noted that sync-directory is already cautious about relative paths, maybe this is related.
The solution would be to normalize paths.
The text was updated successfully, but these errors were encountered:
phbernard
changed the title
Canonicalize 'from' and 'to' paths
Normalize 'from' and 'to' paths
Aug 20, 2021
When using double dots in 'from' path (eg
/path/to/your/../my/files
), sync-directory can have an unexpected behavior.For example,
/path/to/my/files
contains a single file,myfile
. Let's run sync-directory from/path/to/your/../my/files
to/path/to/dest
on watch mode. At launch, it creates the/path/to/dest
and populates it withmyfile
, as expected. But when/path/to/my/files/myfile
is edited,/path/to/dest
is turned into a file (not a directory anymore), filled with/path/to/my/files/myfile
's content. Run the same sequence again, this time with/path/to/my/files
(same folder, but without the double dots), and everything works as expected. I observed this with node 14 on Windows.I don't think it is necessary to investigate this behavior, but just conclude that double dots notation can lead to unexpected results. I noted that sync-directory is already cautious about relative paths, maybe this is related.
The solution would be to normalize paths.
The text was updated successfully, but these errors were encountered: