Skip to content

fs: fix opts.filter issue in cpSync

Fixes: #44720 (closed)

replicate #44922 for cpSync

issues:

  • copy sync 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 call opts.filter(src, dest) in several places

changes:

  • use checkPathsSync as a central place to validate the paths (with consideration of opts.filter) before copying
  • cleanup: remove startCopy, change function name handleFilterAndCopy to checkParentDir to make it consistent with copy async
  • update tests to test for both copy sync and async

Merge request reports

Loading