add support for Windows paths

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-03-18 11:00:17 +01:00
parent 8fedcb4810
commit 95ba20d7f9
4 changed files with 13 additions and 10 deletions

View file

@ -283,6 +283,7 @@ class ConfigurationManager
$allowedPrefixes = [
'/mnt/',
'/media/',
'/host_mnt/',
];
$isValidPath = false;
@ -298,7 +299,7 @@ class ConfigurationManager
}
if(!$isValidPath) {
throw new InvalidSettingConfigurationException("The path must start with '/mnt/' or '/media/' or be equal to '/var/backups'.");
throw new InvalidSettingConfigurationException("The path must start with '/mnt/', '/media/' or '/host_mnt/' or be equal to '/var/backups'.");
}

View file

@ -179,12 +179,12 @@
<h2>Backup and restore</h2>
Please type in the directory where backups will get created on the host system:<br><br>
<form method="POST" action="/api/configuration" class="xhr">
<input type="text" name="borg_backup_host_location" value="/mnt/backup" placeholder="/mnt/backup"/>
<input type="text" name="borg_backup_host_location" placeholder="/mnt/backup"/>
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Submit" />
</form>
The folder path that you enter must start with <b>/mnt/</b> or <b>/media/</b> or be equal to <b>/var/backups</b>. So e.g. <b>/mnt/backup</b> or <b>/var/backups</b>
The folder path that you enter must start with <b>/mnt/</b>, <b>/media/</b> or <b>/host_mnt/</b> or be equal to <b>/var/backups</b>.<br>So e.g. <b>/mnt/backup</b> on Linux and macOS or <b>/host_mnt/c/backup/directory</b> on Windows. (This Windows example would be equivalent to 'C:\backup\directory' on the Windows host. So you need to translate the path that you want to use into the correct format.)
{% endif %}
{% if borg_backup_host_location != "" %}