summaryrefslogtreecommitdiffstats
path: root/scripts/rewrite2mojo.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rewrite2mojo.pl')
-rwxr-xr-xscripts/rewrite2mojo.pl19
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/rewrite2mojo.pl b/scripts/rewrite2mojo.pl
index 42188d739..66fc0d832 100755
--- a/scripts/rewrite2mojo.pl
+++ b/scripts/rewrite2mojo.pl
@@ -17,22 +17,29 @@ while (<>) {
my ($regex, $target, $flags) = @args;
$flags //= '';
next if $flags =~ /E=HTTP/;
+ next if $target eq '-';
+ next if $target =~ /BzAPI/;
+ next if $target =~ /rest\.cgi/;
my $action = 'rewrite_query';
if ($flags =~ /R/) {
$action = 'redirect';
}
- say qq{# from line $. of $ARGV};
say "if (my \@match = \$path =~ m{$regex}s) {";
say " $action(\$c, q{$target}, \@match);";
say " return;" if $flags =~ /L/;
say "}";
}
elsif (lc($cmd) eq "\LRedirect") {
- say qq{# from line $. of $ARGV};
- say "if (my \@match = \$path =~ m{$regex}s) {";
- say " $action(\$c, q{$target}, \@match);";
- say " return;" if $flags =~ /L/;
- say "}";
+ my ($type, $path, $url) = @args;
+ if ($type eq 'permanent') {
+ say "if (\$path =~ m{^\Q$path\E}s) {";
+ say " redirect(\$c, q{$url});";
+ say " return;";
+ say "}";
+ }
+ else {
+ warn "I don't understand Redirect $type\n";
+ }
}
}