[open-ils-commits] r20390 - trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 3 23:46:30 EDT 2011
Author: dbs
Date: 2011-05-03 23:46:27 -0400 (Tue, 03 May 2011)
New Revision: 20390
Modified:
trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Log:
Prevent uninitialized var warnings in OpenILS::WWW::SuperCat::unapi
Given a tag URI like tag:localhost,2011:biblio-record_entry/1 with
no format, Evergreen was throwing uninitialized variable warnings
and attempting to invoke "open-ils.supercat..formats" due to the
unitialized $type variable, which resulted in an Apache error.
On the TT OPAC, this enables Zotero to successfully offer import
of all entries on the search results page. On the AjaxPAC, it seems
that Zotero parses the page before the unAPI hrefs have been supplied
by JavaScript.
Signed-off-by: Dan Scott <dan at coffeecode.net>
Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm 2011-05-03 16:55:48 UTC (rev 20389)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm 2011-05-04 03:46:27 UTC (rev 20390)
@@ -281,7 +281,7 @@
=cut
sub parse_feed_type {
- my $type = shift;
+ my $type = shift || '';
if ($type =~ /-full$/o) {
return 1;
@@ -412,21 +412,22 @@
# Enable localized results of copy status, etc
$supercat->session_locale($locale);
- my $format = $cgi->param('format');
+ my $format = $cgi->param('format') || '';
my $flesh_feed = parse_feed_type($format);
(my $base_format = $format) =~ s/(-full|-uris)$//o;
- my ($id,$type,$command,$lib,$depth,$paging) = ('','','');
+ my ($id,$type,$command,$lib,$depth,$paging) = ('','record','');
+ my $body = "Content-type: application/xml; charset=utf-8\n\n";
+ if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
+ $id = $2;
+ $paging = $3;
+ ($lib,$depth) = split('/', $4);
+ $type = 'metarecord' if ($1 =~ /^m/o);
+ $type = 'authority' if ($1 =~ /^authority/o);
+ }
+
if (!$format) {
- my $body = "Content-type: application/xml; charset=utf-8\n\n";
-
if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
- $id = $2;
- $paging = $3;
- ($lib,$depth) = split('/', $4);
- $type = 'record';
- $type = 'metarecord' if ($1 =~ /^m/o);
- $type = 'authority' if ($1 =~ /^authority/o);
my $list = $supercat
->request("open-ils.supercat.$type.formats")
More information about the open-ils-commits
mailing list