Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SocketAPI: Do not strip trailing whitespace from paths #9452

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/unreleased/9030
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix: 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
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