Skip to content

Linkify command bug. Overwriting previous entries #3457

@akaleeroy

Description

@akaleeroy

Describe the bug

Clipboard history gets overwritten by commands like Linkify, which are expected to alter the current item only

To Reproduce

  1. Save Linkify command as linkify.ini and Load it from the Commands dialog
  2. Copy https://example.com/foo, first entry is created with the linkified content <a href="https://example.com/bar">https://example.com/bar</a> or whatever
  3. Copy https://example.com/bar, a second entry is created correctly AND the first entry, now index 2, is modified to be /bar

Expected behavior

Clipboard history is not corrupted

Screenshots

Version, OS and Environment

  • CopyQ Clipboard Manager 13.0.0

  • Qt: 6.8.3

  • KNotifications: 6.12.0

  • Compiler: MSVC

  • Arch: x86_64-little_endian-llp64

  • OS: Windows 10 Version 22H2

  • Installation method: Windows installer

Additional context

Like #3381 suspected some old backup was at fault, so I used Windows Sandbox with a fresh install. For all users, for current user, with and without translations activated. It't not because of restoring old backups, happens fresh too.

Workaround

Adding add(getItem(0)) and remove(1) seems to fix the overwriting

[Command]
Automatic=true
Command="
    copyq:
    add(getItem(0))
    const link = str(input());
    const href = `<a href=\"${link}\">${link}</a>`;
    setData('text/html', href);"
    remove(1)
Icon=\xf127
Input=text/plain
Match=^(https?|ftps?|file|mailto)://
Name=Linkify

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions