Skip to content

Open the first link from clipboard text with multiple URLs - #16564

Open
AksharP5 wants to merge 1 commit into
omacom:quattrofrom
AksharP5:fix-clipboard-link
Open

AksharP5 wants to merge 1 commit into
omacom:quattrofrom
AksharP5:fix-clipboard-link

Conversation

@AksharP5

Copy link
Copy Markdown
Contributor

Opening clipboard text with two links on one line hands the browser both URLs joined into one malformed address. Keep only the first extracted match, matching what the helper already does when the links are on separate lines.

grep -m1 stops after one matching input line, but -o can print several URLs from it. Select the first output line and strengthen the existing URL fixture to cover the failure.

Same clipboard text Before After
See https://example.com/first and https://example.org/second One argument containing both URLs separated by a newline https://example.com/first
Links on separate lines First URL First URL
Single URL with query and fragment Original URL Original URL

Validation: the updated regression fails on the baseline; all 84 clipboard checks pass with the fix. Five independent real-helper cases cover the two link layouts, a single URL, a bare domain and plain text. Bash syntax and git diff --check pass. Tests use temporary history files and record browser/editor calls without launching desktop apps.

Fixes #16563

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

omarchy-clipboard-open now opens only the first URL when clipboard text contains several links on one line.

  • Clipboard text with several links opens the first one.

Reviews (1) · Last reviewed commit: "Open the first link from clipboard text ..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 2aa9c9e, and nothing needs changing.

The bug is real. I reproduced it on a disposable Omarchy worker with my own harness that records what omarchy-launch-browser receives. On quattro, See https://example.com/first and https://example.org/second reaches the browser as one argument with a newline between the two URLs, and so does a line with three links. On this branch only the first URL is passed. With the | head -n 1 reverted, the bug comes back. Links on separate lines, a single URL with a query and fragment, a bare domain, and plain text going to the editor all behave the same before and after.

On the same worker, test/shell.d/clipboard-test.sh passes 84/84 on this head, and it fails with the fix reverted. ./test/cli passes too.

Codex at medium effort reviewed it as a second opinion. It found the change correct and proportionate: with no pipefail, the pipeline takes head's exit status, so an entry with no URL still falls through to the bare-domain match and then the editor. Its one note was that the fixture change replaces the only test of an entry that is just a URL. I left that as it is, because the new fixture runs the same extraction and the regression is what needed covering. Restoring the single-URL case beside it would be a small, optional follow-up. The panel's second model did not answer. Codex's agreement may not be fully independent, because it can read this session's working files.

It fixes #16563. #13706 and #15241 also change omarchy-clipboard-open, but they fix different things (trailing punctuation and trailing newlines), so they don't compete with this one. This is now waiting on the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening clipboard text with two links combines them into one URL

2 participants