summaryrefslogtreecommitdiffstats
path: root/helper.psgi
blob: cc8c648a818d9d870be8ab32bcd599aaaae876c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

use 5.10.1;
use strict;
use warnings;
use Plack::Request;
use Plack::Response;

my $app = sub {
    my $env     = shift;
    my $req     = Plack::Request->new($env);
    my $res     = Plack::Response->new(404);
    my $urlbase = Bugzilla->localconfig->{urlbase};
    my $path    = $req->path;

    if ( $path eq '/quicksearch.html' ) {
        $res->redirect( $urlbase . 'page.cgi?id=quicksearch.html', 301 );
    }
    elsif ( $path eq '/bugwritinghelp.html') {
        $res->redirect( $urlbase . 'page.cgi?id=bug-writing.html', 301 );
    }
    elsif ( $path =~ m{^/(\d+)$}s ) {
        $res->redirect( $urlbase . "show_bug.cgi?id=$1", 301 );
    }
    else {
        $res->body('not found');
    }
    return $res->finalize;
};