fs: fix opts.filter issue in cp async
Fixes: https://github.com/nodejs/node/issues/44720
issues:
- copy API doesn't handle
opts.filter
properly. As a result, the path validation logic still gets triggered even though the file or folder is filtered out - no central place to handle
opts.filter
e.g. need to check and callhandleFilter
before all copies
changes:
- use
checkPaths
as a central place to validate the paths (with consideration of opts.filter) before copying - cleanup: removing handleFilter, startCopy
related PR: #44786