Skip to content

Commit 26873a2

Browse files
committed
Merge pull request livecode#3785 from livecodefraser/bugfix-16790
Remove extraneous newline from clipboardData["files"] on Windows
2 parents dc09bc2 + 60396ff commit 26873a2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

docs/notes/bugfix-16790.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Remove extraneous newline from clipboardData["files"] on Windows

engine/src/w32-clipboard.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,11 @@ MCStringRef MCWin32RawClipboardCommon::DecodeTransferredFileList(MCDataRef p_dat
300300
else
301301
MCStringCreateWithBytes(t_bytes, t_path_char_count*1, kMCStringEncodingNative, false, t_decoded);
302302

303-
// Replace the NULs with newlines
303+
// Replace the NULs with newlines and trim the trailing newline
304304
if (t_decoded != NULL
305305
&& (!MCStringMutableCopyAndRelease(t_decoded, t_decoded)
306306
|| !MCStringFindAndReplaceChar(t_decoded, '\0', '\n', kMCStringOptionCompareExact)
307+
|| !MCStringRemove(t_decoded, MCRangeMake(MCStringGetLength(t_decoded)-1, 1))
307308
|| !MCStringCopyAndRelease(t_decoded, t_decoded)))
308309
{
309310
MCValueRelease(t_decoded);

0 commit comments

Comments
 (0)