Skip to content

Commit

Permalink
SocketAPI: Do not strip trailing whitespace from paths
Browse files Browse the repository at this point in the history
When stripped, the wrong file name is queried in the DB, and the status
badges shown in Finder will not be there.

#9030
  • Loading branch information
erikjv committed Feb 16, 2022
1 parent c8d4bea commit 1306a94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/unreleased/9030
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
macOS: Do not strip trailing whitespace from a file or folder name

https://github.com/owncloud/client/issues/9030
5 changes: 4 additions & 1 deletion src/gui/socketapi/socketapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1306a94

Please sign in to comment.