Skip to content

Commit

Permalink
[qtwayland] Fix url getting broken on openUrl. Contributes to JB#46776
Browse files Browse the repository at this point in the history
UTF-8 string cannot be split in random position and assume getting
valid content on resulting parts. Switched chunk size to be based
on characters, encoded size will vary but don't think that should matter.
  • Loading branch information
pvuorela committed Oct 14, 2019
1 parent 40f8c20 commit bea490a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client/qwaylandwindowmanagerintegration.cpp
Expand Up @@ -134,13 +134,13 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
{
if (isInitialized()) {
QByteArray data = url.toString().toUtf8();
QString data = url.toString();

static const int chunkSize = 128;
while (!data.isEmpty()) {
QByteArray chunk = data.left(chunkSize);
QString chunk = data.left(chunkSize);
data = data.mid(chunkSize);
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
open_url(!data.isEmpty(), chunk);
}
}
}
Expand Down

0 comments on commit bea490a

Please sign in to comment.