From 3ee4b6684d99fd5d87dde5e11731dc866bb988d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org>
Date: Tue, 20 Oct 2020 09:41:53 +0200
Subject: [PATCH] :ambulance: fix(errors) Fix error breadcrumbs when source is
 a tab

Remove trailing ">"

issue #6051
---
 include/errors/class_SimplePluginError.inc | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/errors/class_SimplePluginError.inc b/include/errors/class_SimplePluginError.inc
index 22b2f2cec..38825899f 100644
--- a/include/errors/class_SimplePluginError.inc
+++ b/include/errors/class_SimplePluginError.inc
@@ -104,24 +104,30 @@ class SimplePluginError extends FusionDirectoryError
   {
     $html = '';
 
+    $breadcrumbs = [];
+
     if (isset($this->object)) {
-      $html .= htmlescape($this->object->getBaseObject()->dn.' > ');
+      $breadcrumbs[] = htmlescape($this->object->getBaseObject()->dn);
     }
 
     if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
-      $html .= htmlescape($this->tab->parent->by_name[get_class($this->tab)].' > ');
+      $breadcrumbs[] = htmlescape($this->tab->parent->by_name[get_class($this->tab)]);
     }
 
     if (isset($this->attribute)) {
       $label = $this->attribute->getLabel();
       if (empty($label)) {
-        $html .= '<i>'.htmlescape($this->attribute->getLdapName()).'</i>';
+        $breadcrumbs[] = '<i>'.htmlescape($this->attribute->getLdapName()).'</i>';
       } else {
-        $html .= htmlescape($label);
+        $breadcrumbs[] = htmlescape($label);
       }
       $example = $this->attribute->getExample();
     }
 
+    if (!empty($breadcrumbs)) {
+      $html .= implode(htmlescape(' > '), $breadcrumbs);
+    }
+
     $html .= '<br/><br/>';
 
     $html .= $this->htmlMessage;
-- 
GitLab