Item8180: %BREADCRUMBS% macro defined by BreadCrumbsPlugin displays invalid Topic titles

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release:
Applies To: Extension
Component: BreadCrumbsPlugin
Branches:
Reported By: Foswiki:Main.CorvusCorax
Waiting For:
Last Change By: MichaelDaum
-- CorvusCorax - 12 Jun 2009

Hi

I stumbled over the following bug in BreadCrumbsPlugin (version according to foswiki/bin/configure: v2.30 (3487 (2009-04-17)) )

Sandbox.test had subtopic Sandbox.test2 which had subtopic Sandbox.subtest

(all just with "hello world" as content)

the Breadcrumbs I expected to see with % BREADCRUMBS % were

  • Sandbox >> test >> test2 >> subtopic

but I got

  • Sandbox >> subtopic >> subtopic >> Subtopic

The reason for this is in Plugins/BreadCrumbsPlugin/Core.pm line #304 sub getTopicTitle()

In my installation DBCachePPlugin was NOT installed, so the below fallback code was used. However the first thing the fallback code does is returning % TOPICTITLE % which expanded to the topic title of the current page, not the page given by $theWeb.$theTopic

sub getTopicTitle {
  my ($theWeb, $theTopic) = @_;

  # use DBCachePlugin if installed
  if (Foswiki::Func::getContext()->{'DBCachePluginEnabled'}) {
    require TWiki::Plugins::DBCachePlugin;
    return TWiki::Plugins::DBCachePlugin::getTopicTitle($theWeb, $theTopic);
  }

  # use core means otherwise
  my $topicTitle = Foswiki::Func::getPreferencesValue("TOPICTITLE");
  return $topicTitle if $topicTitle;

  my ($meta, $text) = Foswiki::Func::readTopic($theWeb, $theTopic);
  my $field = $meta->get('FIELD', 'TopicTitle');
  if ($field) {
    $topicTitle = $field->{value};
    return $topicTitle if $topicTitle;
  }

  return $theTopic;
}

applying the following patch asolved the issue for me
# line 316-317
-  my $topicTitle = Foswiki::Func::getPreferencesValue("TOPICTITLE");
-  return $topicTitle if $topicTitle;
+  my $topicTitle;

I think using % TOPICTITLE % there is probably a bad idea in the first place.

Oh damn right.

-- MichaelDaum - 12 Jun 2009
 

ItemTemplate edit

Summary %BREADCRUMBS% macro defined by BreadCrumbsPlugin displays invalid Topic titles
ReportedBy Foswiki:Main.CorvusCorax
Codebase
SVN Range
AppliesTo Extension
Component BreadCrumbsPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
ReleasedIn
Topic revision: r3 - 20 Aug 2009, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy