Skip to content

Commit

Permalink
Item12799: fixed duplicate http header in render rest handler
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/RenderPlugin@17401 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Mar 18, 2014
1 parent 10efa40 commit cf1a679
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion data/System/RenderPlugin.txt
Expand Up @@ -141,11 +141,12 @@ One line description, required for extensions repository catalog.
-->

| Plugin Author: | Michael Daum |
| Copyright ©: | 2006-2013, Michael Daum http://michaeldaumconsulting.com |
| Copyright ©: | 2006-2014, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 18 Mar 2014: | removed duplicate http header from =render= rest handler |
| 01 Nov 2013: | added support for =contenttype= url parameter |
| 10 Jan 2012: | some docu fixes |
| 12 May 2009: | added =template= handler |
Expand Down
14 changes: 10 additions & 4 deletions lib/Foswiki/Plugins/RenderPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2008-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2008-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -22,8 +22,8 @@ use Foswiki::Func ();
use Foswiki::Sandbox() ;
use Encode ();

our $VERSION = '3.20';
our $RELEASE = '3.20';
our $VERSION = '3.21';
our $RELEASE = '3.21';
our $SHORTDESCRIPTION = 'Render <nop>WikiApplications asynchronously';
our $NO_PREFS_IN_TOPIC = 1;

Expand Down Expand Up @@ -52,11 +52,17 @@ sub restRender {
my ($session, $subject, $verb) = @_;

my $query = Foswiki::Func::getCgiQuery();
my $theText = $query->param('text') || '';

return ' ' unless $theText; # must return at least on char as we get a
# premature end of script otherwise

my $theTopic = $query->param('topic') || $session->{topicName};
my $theWeb = $query->param('web') || $session->{webName};
my ($web, $topic) = Foswiki::Func::normalizeWebTopicName($theWeb, $theTopic);

my $result = Foswiki::Func::renderText(restExpand($session, $subject, $verb), $web);
my $result = Foswiki::Func::expandCommonVariables($theText, $topic, $web) || ' ';
$result = Foswiki::Func::renderText($result, $web);

my $contentType = $query->param("contenttype");
$session->writeCompletePage($result, undef, $contentType);
Expand Down

0 comments on commit cf1a679

Please sign in to comment.