From 06253e147a86f326bda981b7995547b32d82f0ec Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 16 Feb 2022 19:46:03 +0100 Subject: [PATCH] SocketAPI: Do not strip trailing whitespace from paths When stripped, the wrong file name is queried in the DB, and the status badges shown in Finder will not be there. https://github.com/owncloud/client/issues/9030 --- changelog/unreleased/9030 | 4 ++++ src/gui/socketapi/socketapi.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/9030 diff --git a/changelog/unreleased/9030 b/changelog/unreleased/9030 new file mode 100644 index 00000000000..1198f21d7b0 --- /dev/null +++ b/changelog/unreleased/9030 @@ -0,0 +1,4 @@ +macOS: Do not strip trailing whitespace from a file or folder name + +https://github.com/owncloud/client/issues/9030 +https://github.com/owncloud/client/pull/9452 diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index 57367049f5b..f14d873b25a 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -341,7 +341,10 @@ void SocketApi::slotReadSocket() while (socket->canReadLine()) { // Make sure to normalize the input from the socket to // make sure that the path will match, especially on OS X. - const QString line = QString::fromUtf8(socket->readLine().trimmed()).normalized(QString::NormalizationForm_C); + QString line = QString::fromUtf8(socket->readLine()).normalized(QString::NormalizationForm_C); + // Note: do NOT use QString::trimmed() here! That will also remove any trailing spaces (which _are_ part of the filename)! + line.chop(1); // remove the '\n' + qCInfo(lcSocketApi) << "Received SocketAPI message <--" << line << "from" << socket; const int argPos = line.indexOf(QLatin1Char(':')); const QByteArray command = line.midRef(0, argPos).toUtf8().toUpper();