From 192a1f7b9c26e1ca038680200d51a7dc666d8a14 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Fri, 9 Nov 2012 16:12:58 -0500 Subject: [PATCH] Prevent odd TPAC base URL redirect As it stands, in a default install, if you browse to http://yourserver.com/eg/opac you are redirected to a login page, and if you login, you then get to the 404 page. This behavior is caused by the fact that *any* URLs which do not match a few select cases are assumed to be "secure" resources, when in fact they might not even exist. This commit catches any attempt to browse this 'base' and simply redirects to the "home" page instead. This addresses the most obvious and likely 404 of this type, but we might consider catching some other cases (e.g. eg/opac/record/). In addition (or as an alternative), we could also create a function call which simply checks the validity of a URL before we ask the user to login to see it. Signed-off-by: Dan Wells Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 0838a29eb5..111245c377 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -111,6 +111,11 @@ sub load { my $path = $self->apache->path_info; + if ($path =~ m|opac/?$|) { + # nowhere specified, just go home + return $self->generic_redirect($self->ctx->{home_page}); + } + (undef, $self->ctx->{mylist}) = $self->fetch_mylist unless $path =~ /opac\/my(opac\/lists|list)/; -- 2.11.0