fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-07-07 04:33 am

[bml] Friendlier error message when a logged-in user tries to load an inaccessible entry

[commit: http://hg.dwscoalition.org/bml/rev/934819846600]

http://bugs.dwscoalition.org/show_bug.cgi?id=2138

Allow BML pages to be redirected internally to other system pages (e.g., for
the new pages that show up when you try to view a protected entry)

Patch by [personal profile] allen.

Files modified:
  • lib/Apache/BML.pm
--------------------------------------------------------------------------------
diff -r bd1001b1fd47 -r 934819846600 lib/Apache/BML.pm
--- a/lib/Apache/BML.pm	Mon Jan 11 04:00:18 2010 +0000
+++ b/lib/Apache/BML.pm	Wed Jul 07 12:38:32 2010 +0800
@@ -326,6 +326,18 @@ sub handler
     BML::send_cookies($req);
 
     $r->pool->cleanup_register(\&reset_codeblock) if $req->{'clean_package'};
+
+    # internal redirect, if set previously
+    if ( $r->notes->{internal_redir} ) {
+        my $int_redir = DW::Routing->call( uri => $r->notes->{internal_redir} );
+        if ( defined $int_redir ) {
+            # we got a match; remove the internal_redir setting, clear the
+            # request cache, and return DECLINED.
+            $r->notes->{internal_redir} = undef;
+            LJ::start_request();
+            return DECLINED;
+        }
+    }
 
     # redirect, if set previously
     if ($req->{'location'}) {
--------------------------------------------------------------------------------