From b3a6e0da65144921a99a369398dd390f5c65bef3 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 14 Jun 2018 14:32:43 -0400 Subject: work in progress --- scripts/rewrite2mojo.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'scripts') 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"; + } } } -- cgit v1.2.3-24-g4f1b