Don't sanitise selected paths from remote hosts. Closes #3006

* If the remote host disconnects during the selection process we will no longer
  have a valid connection, we shouldn't sanitise the resulting path according to
  local filenames.
This commit is contained in:
baldurk
2023-07-31 17:08:37 +01:00
parent 7c1164e060
commit 3d8ad35e9f
2 changed files with 13 additions and 5 deletions
+6 -4
View File
@@ -674,12 +674,14 @@ void CaptureDialog::on_exePathBrowse_clicked()
}
QString filename;
bool remoteSelection = false;
if(m_Ctx.Replay().CurrentRemote().IsValid())
{
VirtualFileDialog vfd(m_Ctx, initDir, this);
RDDialog::show(&vfd);
filename = vfd.chosenPath();
remoteSelection = true;
}
else
{
@@ -688,7 +690,7 @@ void CaptureDialog::on_exePathBrowse_clicked()
if(!filename.isEmpty())
{
SetExecutableFilename(filename);
SetExecutableFilename(filename, remoteSelection);
if(m_Ctx.Replay().CurrentRemote().Protocol() &&
m_Ctx.Replay().CurrentRemote().Protocol()->GetProtocolName() == "adb")
@@ -1031,11 +1033,11 @@ void CaptureDialog::fillProcessList()
}
}
void CaptureDialog::SetExecutableFilename(const rdcstr &filename)
void CaptureDialog::SetExecutableFilename(const rdcstr &filename, bool remoteSelection)
{
QString fn = filename;
if(!m_Ctx.Replay().CurrentRemote().IsValid())
if(!m_Ctx.Replay().CurrentRemote().IsValid() && !remoteSelection)
fn = QDir::toNativeSeparators(QFileInfo(fn).absoluteFilePath());
ui->exePath->setText(fn);
@@ -1061,7 +1063,7 @@ void CaptureDialog::SetExecutableFilename(const rdcstr &filename)
m_Ctx.Replay().CurrentRemote().SetLastCapturePath(fn);
}
else
else if(!remoteSelection)
{
m_Ctx.Config().LastCapturePath = QFileInfo(fn).absolutePath();
m_Ctx.Config().LastCaptureExe = QFileInfo(fn).fileName();
+7 -1
View File
@@ -60,7 +60,11 @@ public:
bool IsInjectMode() override { return m_Inject; }
void SetInjectMode(bool inject) override;
void SetExecutableFilename(const rdcstr &filename) override;
void SetExecutableFilename(const rdcstr &filename) override
{
SetExecutableFilename(filename, false);
}
void SetWorkingDirectory(const rdcstr &dir) override;
void SetCommandLine(const rdcstr &cmd) override;
void SetEnvironmentModifications(const rdcarray<EnvironmentModification> &modifications) override;
@@ -106,6 +110,8 @@ private slots:
void lineEdit_keyPress(QKeyEvent *);
private:
void SetExecutableFilename(const rdcstr &filename, bool remoteSelection);
Ui::CaptureDialog *ui;
ICaptureContext &m_Ctx;
MainWindow *m_Main;