From 178aeb80d22809c3c6c2c6129bbe382118674f35 Mon Sep 17 00:00:00 2001 From: szaimen Date: Fri, 14 Jan 2022 18:23:13 +0100 Subject: [PATCH] improve setting the backup host location and allow `/var/backups` Signed-off-by: szaimen --- php/src/Data/ConfigurationManager.php | 8 ++++++-- php/templates/containers.twig | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 68b34bb4..ab1948e0 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -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'."); } diff --git a/php/templates/containers.twig b/php/templates/containers.twig index 61f7547e..28adb7b8 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -167,7 +167,7 @@ - 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 /mnt/ or /media/ or be equal to /var/backups. So e.g. /mnt/backup or /var/backups {% endif %} {% if borg_backup_host_location != "" %}