Give a custom error message if the backend is not supported.
This fixes #1920
This commit is contained in:
@@ -593,7 +593,7 @@ namespace Duplicati.Library.Main
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Log.WriteErrorMessage(LOGTAG, "FailedOperation", ex, Strings.Controller.FailedOperationMessage(m_options.MainAction, ex.Message));
|
||||
Logging.Log.WriteErrorMessage(LOGTAG, "FailedOperation", ex, Strings.Controller.FailedOperationMessage(m_options.MainAction));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -793,16 +793,16 @@ namespace Duplicati.Library.Main
|
||||
|
||||
if (selectedRetentionOptions.Count() > 1)
|
||||
{
|
||||
throw new Interface.UserInformationException(string.Format("Setting multiple retention options ({0}) is not permitted",
|
||||
String.Join(", ", selectedRetentionOptions.Select(x => "--" + x))), "MultipleRetentionOptionsNotSupported");
|
||||
throw new UserInformationException(string.Format("Setting multiple retention options ({0}) is not permitted",
|
||||
string.Join(", ", selectedRetentionOptions.Select(x => "--" + x))), "MultipleRetentionOptionsNotSupported");
|
||||
}
|
||||
|
||||
// Check Prefix
|
||||
if (!string.IsNullOrWhiteSpace(m_options.Prefix) && m_options.Prefix.Contains("-"))
|
||||
throw new Interface.UserInformationException("The prefix cannot contain hyphens (-)", "PrefixCannotContainHyphens");
|
||||
throw new UserInformationException("The prefix cannot contain hyphens (-)", "PrefixCannotContainHyphens");
|
||||
|
||||
if (m_options.VolumeSize < m_options.Blocksize * 2)
|
||||
throw new Interface.UserInformationException("The volume size must be at least twice the block size", "VolumeSizeTooSmall");
|
||||
throw new UserInformationException("The volume size must be at least twice the block size", "VolumeSizeTooSmall");
|
||||
|
||||
//Check validity of retention-policy option value
|
||||
try
|
||||
@@ -920,12 +920,22 @@ namespace Duplicati.Library.Main
|
||||
}
|
||||
}
|
||||
|
||||
var scheme = Library.Utility.Utility.GuessScheme(m_backendUrl);
|
||||
if (DynamicLoader.BackendLoader.GetSupportedCommands(m_backendUrl) == null)
|
||||
{
|
||||
// If the backend is HTTP or HTTPS, give a custom error message
|
||||
if (string.Equals(scheme, "http", StringComparison.OrdinalIgnoreCase) || string.Equals(scheme, "https", StringComparison.OrdinalIgnoreCase))
|
||||
throw new UserInformationException(Strings.Controller.BackendNotSupportedHttpError, "BackendNotSupportedHttp");
|
||||
|
||||
throw new UserInformationException(Strings.Controller.BackendNotSupportedError(scheme, string.Join(", ", DynamicLoader.BackendLoader.Keys)), "BackendNotSupported");
|
||||
}
|
||||
|
||||
//Inform the user about the deprecated Tardigrade-Backend. They should switch to Storj DCS instead.
|
||||
if (string.Equals(new Library.Utility.Uri(m_backendUrl).Scheme, "tardigrade", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(scheme, "tardigrade", StringComparison.OrdinalIgnoreCase))
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "TardigradeRename", null, "The Tardigrade-backend got renamed to Storj DCS - please migrate your backups to the new configuration by changing the destination storage type to Storj DCS.");
|
||||
|
||||
//Inform the user about the unmaintained Mega support library
|
||||
if (string.Equals(new Library.Utility.Uri(m_backendUrl).Scheme, "mega", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(scheme, "mega", StringComparison.OrdinalIgnoreCase))
|
||||
Logging.Log.WriteWarningMessage(LOGTAG, "MegaUnmaintained", null, "The Mega support library is currently unmaintained and may not work as expected. Mega has not published an official API so it may break at any moment. Please consider migrating to another backend.");
|
||||
|
||||
//TODO: Based on the action, see if all options are relevant
|
||||
|
||||
@@ -36,11 +36,13 @@ namespace Duplicati.Library.Main.Strings
|
||||
public static string UnsupportedOptionWarning(string optionname) { return LC.L(@"The supplied option --{0} is not supported and will be ignored", optionname); }
|
||||
public static string StartingOperationMessage(OperationMode operationname) { return LC.L(@"The operation {0} has started", operationname); }
|
||||
public static string CompletedOperationMessage(OperationMode operationname) { return LC.L(@"The operation {0} has completed", operationname); }
|
||||
public static string FailedOperationMessage(OperationMode operationname, string errormessage) { return LC.L(@"The operation {0} has failed with error: {1}", operationname, errormessage); }
|
||||
public static string FailedOperationMessage(OperationMode operationname) { return LC.L(@"The operation {0} has failed", operationname); }
|
||||
public static string InvalidPathError(string path, string message) { return LC.L(@"Invalid path: ""{0}"" ({1})", path, message); }
|
||||
public static string FailedForceLocaleError(string exMsg) { return LC.L(@"Failed to apply 'force-locale' setting. Please try to update .NET-Framework. Exception was: ""{0}"" ", exMsg); }
|
||||
public static string SourceVolumeNameInvalidError(string filename) { return LC.L(@"The source {0} uses an invalid volume name, aborting backup", filename); }
|
||||
public static string SourceVolumeNameNotFoundError(string filename, Guid volumeGuid) { return LC.L(@"The source {0} is on volume {1}, which could not be found, aborting backup", filename, volumeGuid); }
|
||||
public static string BackendNotSupportedHttpError => LC.L(@"The backend url cannot start with {0} or {1}. If you intend to use a webdav backend, please use a url starting with {2}", "http://", "https://", "webdav://");
|
||||
public static string BackendNotSupportedError(string protocol, string supported) { return LC.L(@"The backend protocol {0} is not supported. Please use one of the following protocols: {1}", protocol, supported); }
|
||||
}
|
||||
|
||||
internal static class Options
|
||||
|
||||
Reference in New Issue
Block a user