[client] clipboard: fix pasting into Nautilus
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

Yet again we have to implement a fix for another Gnome-ism. Why they
dont just implement standard such as rfc2483 is beyond me. Instead they
have decided to implement the undocumented format
`x-special/gnome-copied-files`. You would think that they could at least
remain compatible by trimming `\r` from the lines.

I am so glad KDE is good these days
This commit is contained in:
Geoffrey McRae
2026-08-15 11:31:08 +10:00
parent 935e26d61e
commit a6a9c909b7

View File

@@ -2160,15 +2160,17 @@ static bool getRemoteDatasetNL(struct RemoteDataset * dataset,
}
if (strcmp(mime, FILE_URI_MIME) && strcmp(mime, FILE_GNOME_MIME))
return false;
const bool gnome = !strcmp(mime, FILE_GNOME_MIME);
char * result = NULL;
size_t used = 0;
size_t capacity = 0;
if (!strcmp(mime, FILE_GNOME_MIME))
if (gnome)
{
if (!grow((void **)&result, &capacity, 6U))
if (!grow((void **)&result, &capacity, 5U))
return false;
memcpy(result, "copy\n", 5U);
used = 5U;
memcpy(result, "copy", 4U);
used = 4U;
}
for (struct RemoteNode * node = files.remoteNodes; node; node = node->next)
{
@@ -2185,12 +2187,18 @@ static bool getRemoteDatasetNL(struct RemoteDataset * dataset,
free(raw);
if (!encoded)
goto error;
const size_t line = strlen(FILE_URI_PREFIX) + strlen(encoded) + 2U;
if (!grow((void **)&result, &capacity, used + line + 1U))
{
free(encoded);
goto error;
}
if (gnome)
used += (size_t)snprintf(result + used, capacity - used,
"\n" FILE_URI_PREFIX "%s", encoded);
else
used += (size_t)snprintf(result + used, capacity - used,
FILE_URI_PREFIX "%s\r\n", encoded);
free(encoded);