mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user