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

Don't die silently rewriting links to missing artefacts



Change-Id: Ieb96b77a5d43b329df3e9c5c309c01d413902421
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 431f85f5
......@@ -686,7 +686,12 @@ class HtmlExportOutputFilter {
*/
private function replace_artefact_link($matches) {
$artefactid = $matches[2];
$artefact = artefact_instance_from_id($artefactid);
try {
$artefact = artefact_instance_from_id($artefactid);
}
catch (ArtefactNotFoundException $e) {
return $matches[5];
}
$artefacttype = $artefact->get('artefacttype');
switch ($artefacttype) {
......@@ -713,7 +718,12 @@ class HtmlExportOutputFilter {
*/
private function replace_download_link($matches) {
$artefactid = $matches[2];
$artefact = artefact_instance_from_id($artefactid);
try {
$artefact = artefact_instance_from_id($artefactid);
}
catch (ArtefactNotFoundException $e) {
return '';
}
// If artefact type not something that would be served by download.php,
// replace link with nothing
......@@ -762,7 +772,12 @@ class HtmlExportOutputFilter {
return $this->basepath . $to;
}
case 'profileiconbyid':
$icon = artefact_instance_from_id($options['id']);
try {
$icon = artefact_instance_from_id($options['id']);
}
catch (ArtefactNotFoundException $e) {
return '';
}
if ($icon->get_plugin_name() != 'file') {
return '';
}
......
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