Skip to content

Quote filename on paste#2268

Merged
jeremypw merged 15 commits intomainfrom
quote-pasted-url-text
Mar 12, 2025
Merged

Quote filename on paste#2268
jeremypw merged 15 commits intomainfrom
quote-pasted-url-text

Conversation

@jeremypw
Copy link
Contributor

@jeremypw jeremypw commented Jul 23, 2023

Fixes #664

First commit (fix quotes)

  • Always quote urls in clipboard
  • Remove quotes before creating a Glib.File from the path

Second commit (fix protocol for DND)

  • Clarify when file:// will be included by using explicit parameters for sanitize_path. To avoid unexpected regressions the existing default parameter is kept except in relation to fixing this problem.

With this PR, dragging a file item into a text target and copy/pasting it into a text target both cause a quoted url to be inserted.

There is still a difference between DND and Copy/Paste in that the former always includes the protocol whereas the latter the removes the protocol if it is "file://". This is because the item might be dropped on a target where the protocol is needed. It is up to the target to format the received text according to its needs.

@jeremypw jeremypw requested a review from a team July 23, 2023 15:45
@jeremypw jeremypw marked this pull request as draft July 23, 2023 16:06
@jeremypw jeremypw changed the title Make transfer of files to text target consistent - quoted and without "file://" protocol Make transfer of files to text target both insert a quoted URL Jul 23, 2023
@jeremypw jeremypw changed the title Make transfer of files to text target both insert a quoted URL Make transfer of files to text target always insert a quoted URL Jul 24, 2023
# Conflicts fixed:
#	src/Application.vala
@jeremypw jeremypw changed the title Make transfer of files to text target always insert a quoted URL Dnd files to text target insert a quoted URL with protocol Oct 13, 2023
@jeremypw jeremypw changed the title Dnd files to text target insert a quoted URL with protocol Quote filename on paste Sep 30, 2024
@jeremypw jeremypw marked this pull request as ready for review March 11, 2025 16:10
@jeremypw jeremypw merged commit a79ce22 into main Mar 12, 2025
4 checks passed
@jeremypw jeremypw deleted the quote-pasted-url-text branch March 12, 2025 16:35
lenemter added a commit that referenced this pull request Aug 16, 2025
…e in fileoperations (#2616)

Fixes #2615

After #2268 files being copied or dragged have their name sanitized before being given to the recipient so that they appear correctly when pasted/dropped as text. However, they were not being re-escaped when used in a file operation and this caused the operation to fail for some files. This PR fixes that.

After this PR, copy/dragging a file should work both to a text document or terminal and to another folder in Files (or Dolphin or Nautilus at least).

Note that Dolphin does not unescape filenames when transferred as text but Nautilus does.

Co-authored-by: Leo <lenemter@gmail.com>
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.

Copy/Pasting a file into the terminal does not quote the filename

2 participants