diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index a0e5efde..7ee2411f 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -605,8 +605,6 @@ class Domains extends ApiCommand implements ResourceEntity } else { if (strpos($documentroot, ':') !== false) { Response::standardError('pathmaynotcontaincolon', '', true); - } else { - $documentroot = FileDir::makeCorrectDir($documentroot); } $documentroot = FileDir::makeCorrectDir($documentroot); } @@ -1422,20 +1420,6 @@ class Domains extends ApiCommand implements ResourceEntity } } - $idna_convert = new IdnaWrapper(); - if (preg_match('/^https?\:\/\//', $documentroot)) { - $encoded = $idna_convert->encode($documentroot); - if (!Validate::validateUrl($encoded, true)) { - Response::standardError('invaliddocumentrooturl', '', true); - } - $documentroot = $encoded; - } else { - if (strpos($documentroot, ':') !== false) { - Response::standardError('pathmaynotcontaincolon', '', true); - } - $documentroot = FileDir::makeCorrectDir($documentroot); - } - if ($this->getUserDetail('change_serversettings') == '1') { if (Settings::Get('system.bind_enable') == '1') { $zonefile = Validate::validate($zonefile, 'zonefile', '', '', [], true); @@ -1602,11 +1586,21 @@ class Domains extends ApiCommand implements ResourceEntity $ssl_redirect = 2; } - if (!preg_match('/^https?\:\/\//', $documentroot)) { - if ($documentroot != $result['documentroot']) { + $idna_convert = new IdnaWrapper(); + if ($documentroot != $result['documentroot']) { + if (preg_match('/^https?\:\/\//', $documentroot)) { + $encoded = $idna_convert->encode($documentroot); + if (!Validate::validateUrl($encoded, true)) { + Response::standardError('invaliddocumentrooturl', '', true); + } + $documentroot = $encoded; + } else { if (substr($documentroot, 0, 1) != "/") { $documentroot = $customer['documentroot'] . '/' . $documentroot; } + if (strpos($documentroot, ':') !== false) { + Response::standardError('pathmaynotcontaincolon', '', true); + } $documentroot = FileDir::makeCorrectDir($documentroot); } }