Merge pull request #136 from nextcloud/enh/128/allow-var-backups

improve setting the backup host location and allow `/var/backups`
This commit is contained in:
Simon L 2022-01-24 12:48:04 +01:00 committed by GitHub
commit 06283bdf21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -172,14 +172,18 @@ class ConfigurationManager
$isValidPath = false;
foreach($allowedPrefixes as $allowedPrefix) {
if(str_starts_with($location, $allowedPrefix)) {
if(str_starts_with($location, $allowedPrefix) && !str_ends_with($location, '/')) {
$isValidPath = true;
break;
}
if ($location === '/var/backups') {
$isValidPath = true;
break;
}
}
if(!$isValidPath) {
throw new InvalidSettingConfigurationException("Path must start with /mnt/ or /media/.");
throw new InvalidSettingConfigurationException("The path must start with '/mnt/' or '/media/' or be equal to '/var/backups'.");
}

View file

@ -167,7 +167,7 @@
<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 /mnt/ or /media/ so e.g. /mnt/backup
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>
{% endif %}
{% if borg_backup_host_location != "" %}