Skip to content

Renaming is failing when destination is the same folder as origin #121

@moelders

Description

@moelders

Hello,

I opened the same issue a few days ago in cpy-cli repository (Renaming is failing when destination is the same folder as origin #49), but I have realized that the issue is with cpy library.

What I found is that when you try to copy a file to its same directory using renaming to change its name it fails with this error:

 ✘ [fail]: rename to the same directory Rejected promise returned by test

CpyError: Refusing to copy to itself: `/private/var/folders/7g/nqj3y3v55jdddlg604cf973h0000gp/T/b60e1889-1101-48ae-9d08-9075e8881508/hello.js`

As far as I see in the code, the issue is that before trying to rename the file (in /index.js#L337) it is performing naming validations.

I was not able to fix it by myself and to open a PR.

I hope you can find a solution.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions