mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-22 15:36:52 +00:00
refactor allowed paths
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
b0d83d45a1
commit
d669a0086c
4 changed files with 28 additions and 52 deletions
|
|
@ -282,26 +282,13 @@ class ConfigurationManager
|
|||
* @throws InvalidSettingConfigurationException
|
||||
*/
|
||||
public function SetBorgBackupHostLocation(string $location) : void {
|
||||
$allowedPrefixes = [
|
||||
'/mnt/',
|
||||
'/media/',
|
||||
'/host_mnt/',
|
||||
];
|
||||
|
||||
$isValidPath = false;
|
||||
foreach($allowedPrefixes as $allowedPrefix) {
|
||||
if(str_starts_with($location, $allowedPrefix) && !str_ends_with($location, '/')) {
|
||||
$isValidPath = true;
|
||||
break;
|
||||
}
|
||||
if ($location === '/var/backups') {
|
||||
$isValidPath = true;
|
||||
break;
|
||||
}
|
||||
if (str_starts_with($location, '/') && !str_ends_with($location, '/')) {
|
||||
$isValidPath = true;
|
||||
}
|
||||
|
||||
if(!$isValidPath) {
|
||||
throw new InvalidSettingConfigurationException("The path must start with '/mnt/', '/media/' or '/host_mnt/' or be equal to '/var/backups'.");
|
||||
if (!$isValidPath) {
|
||||
throw new InvalidSettingConfigurationException("The path must start with '/', and must not end with '/'!");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -323,8 +310,8 @@ class ConfigurationManager
|
|||
$isValidPath = true;
|
||||
}
|
||||
|
||||
if(!$isValidPath) {
|
||||
throw new InvalidSettingConfigurationException("The path may start with '/mnt/', '/media/' or '/host_mnt/' or may be equal to '/var/backups'.");
|
||||
if (!$isValidPath) {
|
||||
throw new InvalidSettingConfigurationException("The path must start with '/', and must not end with '/'!");
|
||||
}
|
||||
|
||||
if ($password === '') {
|
||||
|
|
|
|||
|
|
@ -141,9 +141,10 @@
|
|||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input class="button" type="submit" value="Submit" />
|
||||
</form>
|
||||
The folder path that you enter may start with <b>/mnt/</b>, <b>/media/</b> or <b>/host_mnt/</b> or may be equal to <b>/var/backups</b>.<br><br>
|
||||
An example for Linux and macOS is <b>/mnt/backup</b>.<br>
|
||||
On Windows it might be <b>/host_mnt/c/backup/directory</b>. (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.)<br><br>
|
||||
The folder path that you enter must start with <b>/</b> and must <b>not</b> end with <b>/</b>.<br><br>
|
||||
An example for Linux is <b>/mnt/backup</b>.<br>
|
||||
For macOS it may be <b>/var/backup</b>.<br>
|
||||
On Windows it might be <b>/host_mnt/c/backup</b>. (This Windows example would be equivalent to 'C:\backup' on the Windows host. So you need to translate the path that you want to use into the correct format.)<br><br>
|
||||
⚠ Note that the backup archive must be located in a subfolder of the folder that you enter here and the subfolder which contains the archive must be named 'borg'. Otherwise will the backup container not find the backup archive!<br><br>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
|
@ -293,9 +294,10 @@
|
|||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input class="button" type="submit" value="Submit" />
|
||||
</form>
|
||||
The folder path that you enter may start with <b>/mnt/</b>, <b>/media/</b> or <b>/host_mnt/</b> or may be equal to <b>/var/backups</b>.<br><br>
|
||||
An example for Linux and macOS is <b>/mnt/backup</b>.<br>
|
||||
On Windows it might be <b>/host_mnt/c/backup/directory</b>. (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.)<br><br>
|
||||
The folder path that you enter must start with <b>/</b> and must <b>not</b> end with <b>/</b>.<br><br>
|
||||
An example for Linux is <b>/mnt/backup</b>.<br>
|
||||
For macOS it may be <b>/var/backup</b>.<br>
|
||||
On Windows it might be <b>/host_mnt/c/backup</b>. (This Windows example would be equivalent to 'C:\backup' on the Windows host. So you need to translate the path that you want to use into the correct format.)<br><br>
|
||||
{% endif %}
|
||||
|
||||
{% if borg_backup_host_location != "" %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue