Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL handling in pasteboard operations #5029

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

liby
Copy link
Contributor

@liby liby commented Jan 13, 2025

Description

When pasting URLs from clipboard, the behavior varies based on the source:

  1. From browser address bar:

    • Pasteboard types: ["public.utf8-plain-text", "NSStringPboardType"]

    • Handled as plain text, resulting in correct full URL paste

  2. From clipboard history tools, such as Raycast clipboard history:

    • Pasteboard types include "public.url" and related URL types

    • URL was being processed through NSURL, which only extracted the path component

    • This resulted in incomplete URLs

Changes

  • Modified getOpinionatedStringContents() to differentiate URL types:

    • For file URLs (file://): preserve existing behavior, return path only

    • For web URLs (http://, https://): return full URL string via absoluteString

    • For non-URL content: maintain existing plain text handling

Related Issues

Fixes #5026

@caarlos0 Could you please help check if this resolves the issue you were encountering?

@liby liby force-pushed the fix/pasteboard-url-handling branch from eb413e4 to 46ded47 Compare January 13, 2025 16:43
@liby liby force-pushed the fix/pasteboard-url-handling branch from 46ded47 to 08314d4 Compare January 13, 2025 16:49
@mitchellh mitchellh enabled auto-merge January 13, 2025 20:53
@mitchellh
Copy link
Contributor

Fantastic, thanks

@mitchellh mitchellh merged commit b7eb9bf into ghostty-org:main Jan 13, 2025
30 checks passed
@github-actions github-actions bot added this to the 1.1.0 milestone Jan 13, 2025
@caarlos0
Copy link
Member

I'm late to the party, and afk now, will test it later today.

FWIW I use a clipboard manager as well, forgot its name though 😂

@caarlos0
Copy link
Member

Thanks for the fix btw

@liby liby deleted the fix/pasteboard-url-handling branch January 14, 2025 02:07
@caarlos0
Copy link
Member

just confirming this fixes it for me.

pasteboard manager is maccy fwiw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS: Pasting URL only pastes path (tip regression, 1.0.1 is fine)
3 participants