fixes #796 handle ampersand escaping for API URLs

When generating URLs for the web service (IN_WS), ensure the argument separator is a raw '&' instead of the HTML entity '&'. add_url_params now switches the separator to '&' if IN_WS is defined and '&' was requested. Removed a redundant str_replace call in ws_std_get_urls since get_action_url/add_url_params now produce the correct separator. This prevents double-escaped ampersands.
This commit is contained in:
Linty
2026-03-23 12:26:20 +01:00
parent 001a21056c
commit b19beee0aa
2 changed files with 6 additions and 1 deletions

View File

@@ -104,6 +104,11 @@ function add_url_params($url, $params, $arg_separator='&' )
{
if ( !empty($params) )
{
if (defined('IN_WS') and '&' === $arg_separator)
{
$arg_separator = '&';
}
assert( is_array($params) );
$is_first = true;
foreach($params as $param=>$val)

View File

@@ -169,7 +169,7 @@ function ws_std_get_urls($image_row)
$ret['download_url'] = null;
if ($provide_download_url)
{
$ret['download_url'] = str_replace('&', '&', get_action_url($image_row['id'], 'e', true));
$ret['download_url'] = get_action_url($image_row['id'], 'e', true);
}
$derivatives = DerivativeImage::get_all($src_image);