hluk / hluk/CopyQ

After item is reactivated, pasting fails to rename a file copy in w10 Explorer

Open
#2,120 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
12.3k
Forks
593
Avg merge
2d 8h
Merged PRs (30d)
9

Description

If I use Ctrl-C and Ctrl-V for eg. file `AUTHORS` in the w10 file explorer, the file gets pasted as `AUTHORS - Copy`.
But if I activate a second item and then reactivate the first one before Ctrl-V, the pasting breaks.

Using vanilla setup of CopyQ, simply nothing happens.
This has been addressed using different workarounds:

in #1192 ...

> ```ini
> [Command]
> Automatic=true
> Icon=\xf0c1
> Input=text/uri-list
> Name=Copy Files/URIs
> ```

and in #1223 ...

\+ the [FAQ](https://copyq.readthedocs.io/en/latest/faq.html#how-to-reuse-file-paths-copied-from-a-file-manager):

> ```ini
> [Command]
> Command="
> var originalFunction = global.clipboardFormatsToSave
> global.clipboardFormatsToSave = function() {
> return originalFunction().concat([
> mimeUriList,
> 'x-special/gnome-copied-files',
> 'application/x-kde-cutselection',
> ])
> }"
> Icon=\xf0c1
> IsScript=true
> Name=Store File Manager Metadata
> ```

**Now** if add any of these two and repeat the sequence, the first file gets pasted.
But **only if** I go to a different folder containing no file with the same name.

When I stay in the same folder (where the original file resides) and press Ctrl-V, the copy isn't created.
Instead I get following error in file explorer:

### The source and destination file names are the same.

---

**To Reproduce**
Steps to reproduce the behavior:

1. Use w10 desktop
2. Configure one of aforementioned workarounds
3. Go to the `CopyQ` folder using file explorer
4. Check if the manager is empty using MSYS2:
```
$ cd 'C:\Program Files (x86)\CopyQ\'
$ pwd
/c/Program Files (x86)/CopyQ
$ ./copyq count
0
```
5. Click on `AUTHORS` file
6. Press **Ctrl-C**
7. Press F2, **Ctrl-C**, Esc (copy the file name only)
8. Check if there are two items in the manager:
```
$ ./copyq count
2
```
9. Select the original item (shown as `2` in the GUI but numbered as `1` in the CLI):
```
$ ./copyq select 1
```
10. Go to the file explorer, press **Ctrl-V**
11. See error: **The source and destination file names are the same.**

---

**Expected behavior**

The `AUTHORS` files should get copied as `AUTHORS - Copy` in file explorer (as it happens before the item reactivation).

**Screenshots**

The error message:
![image](https://user-images.githubusercontent.com/7887758/193011667-42576c7c-85f0-4a58-9f5d-f41cb813c163.png)

**Version, OS and Environment**
```
CopyQ Clipboard Manager 6.3.2
Qt: 5.15.2
KNotifications: 5.92.0
Compiler: MSVC
Arch: x86_64-little_endian-llp64
OS: Windows 10 Version 2009
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.