Commit aac4f665 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow for unencoded '&' when rewriting download links during html export (see bug #548308)


Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 6a88b5d1
...@@ -630,7 +630,7 @@ class HtmlExportOutputFilter { ...@@ -630,7 +630,7 @@ class HtmlExportOutputFilter {
// Links to download files // Links to download files
$html = preg_replace_callback( $html = preg_replace_callback(
'#(?<=[\'"])(' . $wwwroot . ')?/?artefact/file/download\.php\?file=(\d+)((&amp;[a-z]+=[x0-9]+)+)*#', '#(?<=[\'"])(' . $wwwroot . ')?/?artefact/file/download\.php\?file=(\d+)(?:(?:&amp;|&|%26)([a-z]+=[x0-9]+)+)*#',
array($this, 'replace_download_link'), array($this, 'replace_download_link'),
$html $html
); );
...@@ -711,12 +711,9 @@ class HtmlExportOutputFilter { ...@@ -711,12 +711,9 @@ class HtmlExportOutputFilter {
} }
$options = array(); $options = array();
if (isset($matches[3])) { for ($i = 3; $i < count($matches); $i++) {
$parts = explode('&amp;', substr($matches[3], 5)); list($key, $value) = explode('=', $matches[$i]);
foreach ($parts as $part) { $options[$key] = $value;
list($key, $value) = explode('=', $part);
$options[$key] = $value;
}
} }
$folderpath = $this->get_folder_path_for_file($artefact); $folderpath = $this->get_folder_path_for_file($artefact);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment