webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

fix(copy-files): use context realpath

Open QWp6t opened this issue 6 years ago • 4 comments

In scenarios where context is within a symlink, path.relative() will return an undesired path because the resource path follows symlinks. We resolve this by using fs.realpathSync(options.context).

QWp6t avatar Sep 17 '19 10:09 QWp6t

don't you need to do this both for the resource path and the content though ?

stof avatar Sep 17 '19 16:09 stof

In my testing, which was not very extensive at all, the symlink had already been followed for the resourcePath. I didn't investigate where it gets it, though, or if there are any caveats.

At any rate, I can do the same for the resource path too if you want.

QWp6t avatar Sep 18 '19 05:09 QWp6t

Could you maybe add some functional tests using symlinks?

Yes, this would be great! It can be added in this section - probably we could just create a symlink at the start of the test, make sure that file is copied, then clean up the symlink after. Can you try that @QWp6t?

Thanks!

https://github.com/symfony/webpack-encore/blob/master/test/functional.js#L1753

weaverryan avatar Oct 07 '19 18:10 weaverryan

Hey guys, just wanted to stop by to mention I haven't forgotten about this PR. Yes, I can add some tests, but I have a deadline coming up, so it'll have to wait a bit. I think you guys have access to push to my fork if you're wanting to fast-track this for whatever reason, otherwise I'll make the changes you requested just as soon as I'm finished with work, probably end of next week.

Have a good week! 🍻

QWp6t avatar Oct 09 '19 15:10 QWp6t