Fix issue where remote URL defined using run-script-before was ignored.

Previously, we were declaring that the m_remoteurl field be passed by
reference to the Execute method.  However, the OnStart method declared
that the remoteurl variable was to be passed by reference.  As a result,
the caller (Controller.SetupCommonOptions) method never received the
updated value.

Now, the variables being passed by reference are made consistent.

This fixes #3651.
This commit is contained in:
Kenneth Hsu
2020-11-01 13:13:54 -08:00
parent b6e1618947
commit 49e026ee92
@@ -153,16 +153,17 @@ namespace Duplicati.Library.Modules.Builtin
public void OnStart(string operationname, ref string remoteurl, ref string[] localpath)
{
if (!string.IsNullOrEmpty(m_requiredScript))
Execute(m_requiredScript, "BEFORE", operationname, ref remoteurl, ref localpath, m_timeout, true, m_options, null, null);
if (!string.IsNullOrEmpty(m_startScript))
Execute(m_startScript, "BEFORE", operationname, ref remoteurl, ref localpath, m_timeout, false, m_options, null, null);
// Save options that might be set by a --run-script-before script so that the OnFinish method
// references the same values.
m_operationName = operationname;
m_remoteurl = remoteurl;
m_localpath = localpath;
if (!string.IsNullOrEmpty(m_requiredScript))
Execute(m_requiredScript, "BEFORE", m_operationName, ref m_remoteurl, ref m_localpath, m_timeout, true, m_options, null, null);
if (!string.IsNullOrEmpty(m_startScript))
Execute(m_startScript, "BEFORE", m_operationName, ref m_remoteurl, ref m_localpath, m_timeout, false, m_options, null, null);
}
public void OnFinish (object result)