summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-06-14 20:32:43 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:58 +0200
commitb3a6e0da65144921a99a369398dd390f5c65bef3 (patch)
tree599fe3abc1c6837fbdd55272968bee1a29363020 /scripts
parent258d3e1c7d5d99ab202ffe5ce777c435fc34d44a (diff)
downloadbugzilla-b3a6e0da65144921a99a369398dd390f5c65bef3.tar.gz
bugzilla-b3a6e0da65144921a99a369398dd390f5c65bef3.tar.xz
work in progress
Diffstat (limited to 'scripts')
-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";
+ }
}
}