Skip to content

Avoid sentence-ending periods in clipboard links - #13706

Open
Inference1 wants to merge 2 commits into
omacom:quattrofrom
Inference1:fix/clipboard-url-punctuation
Open

Inference1 wants to merge 2 commits into
omacom:quattrofrom
Inference1:fix/clipboard-url-punctuation

Conversation

@Inference1

@Inference1 Inference1 commented Sep 29, 2026 •

Copy link
Copy Markdown

Problem

Opening a clipboard text entry containing a sentence such as See https://example.com/docs. currently passes https://example.com/docs. to the browser. The final period belongs to the sentence, but omarchy-clipboard-open includes it in the URL path, which may open a different page. The existing clipboard test covers a standalone URL, not a link embedded in prose. There is no linked issue for this locally reproduced case.

To reproduce through the UI, copy that sentence, open it from clipboard history, and inspect the browser address. The expected address is https://example.com/docs.

Change

The command now removes one trailing period from an extracted URL when the clipboard entry contains more than the URL itself. This keeps the fix focused on sentence punctuation:

Clipboard text Browser argument
See https://example.com/docs. https://example.com/docs
https://example.com/file. https://example.com/file.
https://example.com/docs?q=a.b https://example.com/docs?q=a.b

Text without a URL still opens in the editor. URL discovery order, bare-domain fallback, and clipboard history contents are unchanged.

Validation

  • Added test/shell.d/clipboard-open-test.sh, which runs the real command with a temporary home and stubs only jq, the browser, and the editor. Before the production change, the target assertion failed with got: https://example.com/docs.. After the change, all four checks pass in Git Bash and Ubuntu 24.04 WSL (Bash 5.2.21), including the plain-text editor path.
  • bash -n bin/omarchy-clipboard-open test/shell.d/clipboard-open-test.sh: pass.
  • bash bin/omarchy commands --check: pass (469 commands).
  • git diff --check: pass.
  • ./test/all in an Ubuntu 24.04 temporary checkout: not passing in this environment. The patched checkout failed 127/287 Shell test files; the unmodified checkout failed 128/286 in the same environment. The new test passed inside the aggregate run, and no test file failed only with this change. The environment lacks Node, jq, lua, socat, magick, Omarchy-specific services, and the companion packaging checkout.

I could not perform an end-to-end clipboard UI check because this machine has no Omarchy desktop session.

@Inference1
Inference1 marked this pull request as ready for review September 29, 2026 03:05
@Inference1

Copy link
Copy Markdown
Author

Would you please review this pr

@sanjyay

sanjyay commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This is an independent community review and unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Tested commit 25fb603ac0977cf0df436162104ae8198f3c18b8 in a clean Omarchy test environment.

Verification Summary

  • Base Reproduction (origin/quattro): Running omarchy-clipboard-open --history-index 0 on an entry containing See https://example.com/docs. passed https://example.com/docs. directly to the browser launcher. When running the new test suite on base, it failed as expected:
    got: https://example.com/docs.
    not ok - clipboard open leaves sentence punctuation out of the browser URL
    
  • PR Branch Verification (pr-13706):
    • Trimming the trailing dot when $text != "$url" correctly passes https://example.com/docs to the browser while preserving query parameters (?q=a.b) and literal dots in standalone URLs (https://example.com/file.).
    • Plain-text fallback without URLs correctly creates the scratch buffer and opens the editor without invoking the browser.
    • All 4 assertions in test/shell.d/clipboard-open-test.sh pass cleanly.
    • omarchy commands --check passed across 467 commands.
Verification output
$ ./test/shell.d/clipboard-open-test.sh
ok - clipboard open leaves sentence punctuation out of the browser URL
ok - clipboard open preserves punctuation inside a URL
ok - clipboard open keeps a literal period in a standalone URL
ok - clipboard open passes plain text to the editor unchanged

$ omarchy commands --check
Command metadata check passed (467 commands)

The implementation is minimal, cleanly isolates sentence punctuation from standalone links, and includes good regression coverage.

If you'd prefer not to receive these independent reviews on your PRs, reply to this comment and say so, and I won't review your future PRs.

@Inference1

Copy link
Copy Markdown
Author

Thanks for the independent verification. The baseline reproduction and PR-branch checks are very helpful. I’m happy to keep the review on this PR.

@omarchybot omarchybot added the bug Something isn't working label Oct 1, 2026
@Inference1

Copy link
Copy Markdown
Author

@omarchybot Would you please check and confirm whether it can be merged

An entry of only a URL plus spaces, such as "https://example.com/file. ", counted as more than the URL, so its literal trailing period was stripped. Compare against the entry with surrounding whitespace ignored instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 3, 2026
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low risk] Strips trailing periods from clipboard-extracted URLs.

The PR should not merge until embedded URLs with literal trailing periods are handled without changing their addresses.

Findings

  1. P1 Valid URL period removed ▶

Summary

The PR removes one trailing period from an extracted clipboard URL when the entry contains surrounding text and adds focused shell tests for that behavior.

  • Standalone URLs retain their trailing period; embedded URLs do not, even when the period is part of the address.

Reviews (1) · Last reviewed commit: "Keep a standalone URL's period when the ..."

Comment on lines +43 to +44
if [[ -n $url && $url == *. && ! $text =~ ^[[:space:]]*"$url"[[:space:]]*$ ]]; then
url=${url%.}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Valid URL period removed

When prose contains a URL whose path genuinely ends in a period, such as Download https://example.com/file. from here, this check removes that period because the URL has surrounding text. The browser receives https://example.com/file instead of the linked address, potentially opening a different resource.

@omarchybot omarchybot added the ready Good to merge label Oct 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy worker. The fix is sound, and I pushed one small correction to your branch.

Reproduction. I ran omarchy-clipboard-open against a real clipboard history file and real jq, stubbing only the browser and editor launchers. On quattro (a85e29a), See https://example.com/docs. opens https://example.com/docs.. On this branch, and with it merged into quattro, it opens https://example.com/docs. With the three-line fix reverted, the bug comes back. A URL that is the whole entry keeps its period, query strings with dots are untouched, the bare-domain fallback and the plain-text editor path behave as before, and omarchy commands --check passes.

What I changed (2244eba). An entry of only a URL plus surrounding whitespace, such as https://example.com/file. (easy to get from a terminal selection), counted as "more than the URL", so its literal period was stripped. The condition now ignores surrounding whitespace: ! $text =~ ^[[:space:]]*"$url"[[:space:]]*$. I added a test case for it that fails on 25fb603 and passes now. Clearing the browser output first keeps that case from passing on the previous case's leftover output.

Tests. test/shell.d/clipboard-open-test.sh (5/5) and clipboard-test.sh (73/73) pass on the worker. The full ./test/cli and shell suite show the same 7 failures here as on quattro itself (theme, logo, kernel-headers, browser-focus, portal and pre_remove tests), and none involve this change.

Second opinion. Codex at medium effort reviewed it twice. Round one found the whitespace case above, which I hadn't caught on my own. Round two checked the correction, including that the quoted $url matches literally even when it contains regex metacharacters, and found nothing further.

Greptile's comment on line 44 (Download https://example.com/file. from here loses a real period) is accurate but describes the trade-off this PR deliberately makes, not a defect. In prose, a period after a link almost always ends the sentence, and a URL that really ends in . is rare. The case where the period is unambiguous, a bare URL, keeps it. I left it as is.

Overlap. #11920 rewrites how this command reads the history entry (jq -ec '.[$index]', then .type and .text from it). The jq stub in the new test only answers the current queries, so whichever of the two lands second needs the stub adjusted.

This is now waiting on the maintainer.

@Inference1

Copy link
Copy Markdown
Author

@omarchybot merge-ready

@Inference1

Copy link
Copy Markdown
Author

@omarchybot Please help me ask the maintainer to take a look and advise on how to merge it in.

@Inference1

Copy link
Copy Markdown
Author

when to merge

@Inference1

Copy link
Copy Markdown
Author

merge this

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

Labels

bug Something isn't working 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.

3 participants