Permalink
Browse files

Item13899: Make sure text param is processed

  • Loading branch information...
1 parent 20f6d8e commit cb452f8c6282d78f631b84c942d59f7082edecaa @gac410 gac410 committed Dec 25, 2015
Showing with 8 additions and 5 deletions.
  1. +8 −5 core/lib/Foswiki/UI/Save.pm
@@ -177,17 +177,20 @@ sub buildNewTopic {
$ancestorRev = 0;
}
- $text = $query->param('text') if scalar $query->param('text');
- if ( defined $text ) {
+ # $text now contains either text from an existing topic.
+ # or text obtained from a template topic. Now determine if
+ # the query params will override it.
+ if ( defined $query->param('text') ) {
# text is defined in the query, save that text, overriding anything
# from the template or the previous rev of the topic
+ $text = $query->param('text');
$text =~ s/\r//g;
$text .= "\n" unless $text =~ m/\n$/s;
}
- else {
- $text = '';
- }
+
+ # Make sure that text is defined.
+ $text = '' unless defined $text;
# Change the parent, if appropriate
my $newParent = $query->param('topicparent');

0 comments on commit cb452f8

Please sign in to comment.