CLI serve command: fix default public root URL

This commit is contained in:
Benjamin Renard 2025-03-27 09:59:12 +01:00
parent eb6161aa6c
commit 882ba3b672
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
2 changed files with 2 additions and 4 deletions

View file

@ -311,7 +311,7 @@ Additional parameters:
*/
public static function cli_serve($command_args) {
$listen_address = null;
$public_url = null;
$public_url = "/";
$enable_profiler = false;
$profiler_output_dir = realpath(getcwd());
for($i=0; $i < count($command_args); $i++) {
@ -376,8 +376,6 @@ Additional parameters:
I18n::_('Invalid listen port specified. Must be a positive integer between 1 and 65535.')
);
$listen_address = implode(':', $parts);
if (is_null($public_url))
$public_url = sprintf("http://%s:%s", $parts[0]=='0.0.0.0'?'127.0.0.1':$parts[0], $parts[1]);
$public_html = App::get('root_directory_path')."/public_html";
chdir($public_html) or self :: fatal_error(

View file

@ -7,7 +7,7 @@
<meta name="description" content=""/>
<meta name="author" content=""/>
<base href="{$public_root_url}/"/>
<base href="{if $public_root_url!= "/"}{$public_root_url}{/if}/"/>
{block name="head"}{/block}
{block name="favicon"}