From a6e32d763f2080e99f36d0174ec78c2f85a3da8d Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Tue, 26 Mar 2019 11:58:06 +0100 Subject: [PATCH] ObjectPreview: Avoid linking a flat command attribute inside a command --- library/Director/Web/ObjectPreview.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/library/Director/Web/ObjectPreview.php b/library/Director/Web/ObjectPreview.php index 96eda238..f54009a2 100644 --- a/library/Director/Web/ObjectPreview.php +++ b/library/Director/Web/ObjectPreview.php @@ -99,17 +99,23 @@ class ObjectPreview $classes[] = 'logfile'; } + $type = $object->getShortTableName(); + $plain = Html::wantHtml($file->getContent())->render(); $plain = preg_replace_callback( '/^(\s+import\s+\"\;)(.+)(\"\;)/m', [$this, 'linkImport'], $plain ); - $plain = preg_replace_callback( - '/^(\s+(?:check_|event_)?command\s+=\s+\"\;)(.+)(\"\;)/m', - [$this, 'linkCommand'], - $plain - ); + + if ($type !== 'command') { + $plain = preg_replace_callback( + '/^(\s+(?:check_|event_)?command\s+=\s+\"\;)(.+)(\"\;)/m', + [$this, 'linkCommand'], + $plain + ); + } + $plain = preg_replace_callback( '/^(\s+host_name\s+=\s+\"\;)(.+)(\"\;)/m', [$this, 'linkHost'],