]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwStream.pm
www_stream: fix search for new.html endpoint
[public-inbox.git] / lib / PublicInbox / WwwStream.pm
index d2bf318bed49a6027e68f7a696a91de1ff29de61..d9abb5ab8068756d51c3f5aaae5b9098703744ce 100644 (file)
@@ -14,6 +14,12 @@ sub new {
        bless { nr => 0, cb => $cb, ctx => $ctx }, $class;
 }
 
+sub response {
+       my ($class, $ctx, $code, $cb) = @_;
+       [ $code, [ 'Content-Type', 'text/html; charset=UTF-8' ],
+         $class->new($ctx, $cb) ]
+}
+
 sub _html_top ($) {
        my ($self) = @_;
        my $ctx = $self->{ctx};
@@ -33,7 +39,8 @@ sub _html_top ($) {
                }
                # XXX gross, for SearchView.pm
                my $extra = $ctx->{-extra_form_html} || '';
-               $top = qq{<form\naction="$upfx"><pre>$top} .
+               my $action = $upfx eq '' ? './' : $upfx;
+               $top = qq{<form\naction="$action"><pre>$top} .
                          qq{ <input\nname=q\ntype=text$q_val/>} .
                          $extra .
                          qq{<input\ntype=submit\nvalue=search />} .