From: Dominik Schmidt Date: Wed, 13 Jun 2018 20:23:21 +0000 (+0200) Subject: Escape msi and owncloud.exe path (who knows...) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~46^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dfac8c0e59641471c28d110f9cdb6b83fb5b4b8c;p=nextcloud-desktop.git Escape msi and owncloud.exe path (who knows...) --- diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index c88eb0cca..dcfcaefd4 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -202,9 +202,15 @@ void OCUpdater::slotStartInstaller() // manually here. We wrap the msiexec and client invocation in a powershell // script because owncloud.exe will be shut down for installation. // | Out-Null forces powershell to wait for msiexec to finish. - QString command = QString("&{msiexec /norestart /passive /i '%1' | Out-Null ; &'%2'}") - .arg(QDir::toNativeSeparators(updateFile)) - .arg(QDir::toNativeSeparators(QCoreApplication::applicationFilePath())); + auto preparePathForPowershell = [](QString path) { + path.replace("'", "''"); + + return QDir::toNativeSeparators(path); + }; + + QString command = QString("&{msiexec /norestart /passive /i '%1'| Out-Null ; &'%2'}") + .arg(preparePathForPowershell(updateFile)) + .arg(preparePathForPowershell(QCoreApplication::applicationFilePath())); QProcess::startDetached("powershell.exe", QStringList{"-Command", command}); }