Item14451: edited topics don't validate - (500) Internal server error - Invalid web '-Xx.LastXx' in topics

pencil
Priority: Enhancement
Current State: No Action Required
Released In: n/a
Target Release:
Applies To: Extension
Component: PublishPlugin
Branches:
Reported By: FlorianSchlichting
Waiting For:
Last Change By: CrawfordCurrie
validateWebTopicName() fails to validate items that were prefixed with a minus sign to edit them out of the list of topics. For example, using the topics list from the documentation:

$ perl rest /PublishPlugin/publish format=file topics='*.*,-*.Last*,*.Last*'                                                                                                                                                                                            
*Publisher:* AdminUser
*Date:* 2017-08-01 - 14:55
format = 'file'
topics = '*.*,-*.Last*,*.Last*'
ERROR: (500) Internal server error - Invalid web '-Xx.LastXx' in topics at .../lib/Foswiki/Plugins/PublishPlugin/Publisher.pm line 180.
 at .../lib/Foswiki/Plugins/PublishPlugin/Publisher.pm line 180.
        Foswiki::Plugins::PublishPlugin::Publisher::validateWebTopicName("-Xx.LastXx", "topics") called at .../lib/Foswiki/Plugins/PublishPlugin/Publisher.pm line 157
        Foswiki::Plugins::PublishPlugin::Publisher::validateWebTopicWildcard("-*.Last*", "topics") called at .../lib/Foswiki/Plugins/PublishPlugin/Publisher.pm line 122

A possible fix would be (tested here, works for me):

--- a/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm
+++ b/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm
@@ -163,6 +163,8 @@ sub validateWebTopicName {
 
     return undef unless defined $v;
 
+    $v =~ s/^-//;
+
     my ( $w, $t );
     if ( $v =~ /\./ ) {
         ( $w, $t ) = split( /\./, $v, 2 );

-- FlorianSchlichting - 01 Aug 2017

The - is used to indicate that matching topics are to be excluded, it can't just be ignored.

I don't get this error with the latest code, it looks like it was fixed in Item14452.

-- Main.CrawfordCurrie - 30 Jan 2018 - 09:39

 

ItemTemplate edit

Summary edited topics don't validate - (500) Internal server error - Invalid web '-Xx.LastXx' in topics
ReportedBy FlorianSchlichting
Codebase
SVN Range
AppliesTo Extension
Component PublishPlugin
Priority Enhancement
CurrentState No Action Required
WaitingFor
Checkins
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r2 - 30 Jan 2018, CrawfordCurrie
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