Skip to content

Commit 8aa7d81

Browse files
committed
[22591] Fix drag-n-drop onto Mail app if filename has spaces
1 parent a5c2a51 commit 8aa7d81

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

docs/notes/bugfix-22591.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure drag-n-drop of a filename with spaces onto Mail app adds the file as an attachment

engine/src/mac-clipboard.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@
250250
// Undo the transformation of spaces to '+'
251251
if (!MCStringFindAndReplace(*t_modified, MCSTR("+"), MCSTR(" "), kMCStringOptionCompareExact))
252252
return NULL;
253+
// Properly encode spaces
254+
if (!MCStringFindAndReplace(*t_modified, MCSTR(" "), MCSTR("%20"), kMCStringOptionCompareExact))
255+
return NULL;
253256

254257
// Add the required "file://" prefix to the path
255258
if (!MCStringPrepend(*t_modified, MCSTR("file://")))

0 commit comments

Comments
 (0)