Bugzilla – Attachment 76224 Details for
Bug 20971
Corrupted storable string breaks SubfieldsToUseWhenPrefill functionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20971: additem Corrupted storable string
0001-Bug-20971-additem-Corrupted-storable-string.patch (text/plain), 2.41 KB, created by
paxed
on 2018-06-21 08:28:33 UTC
(
hide
)
Description:
Bug 20971: additem Corrupted storable string
Filename:
MIME Type:
Creator:
paxed
Created:
2018-06-21 08:28:33 UTC
Size:
2.41 KB
patch
obsolete
>From 160e9b946e33015ed43f4156f3fbfc148b3df051 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@joensuu.fi> >Date: Thu, 21 Jun 2018 11:15:23 +0300 >Subject: [PATCH] Bug 20971: additem Corrupted storable string > >Sometimes additem.pl will complain about "Storable::thaw failed to >thaw LastCreatedItem-cookie.", see bug 14844. Now, actually fix the bug. > >The bug is caused by trying to URI (un)escape MARC::Record, binary data. >We'll use a base64 url-safe version instead. > >Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi> >--- > cataloguing/additem.pl | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 5cb0809991..384295cda4 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -43,6 +43,7 @@ use C4::Members; > > use MARC::File::XML; > use URI::Escape; >+use MIME::Base64 qw(decode_base64url encode_base64url); > > our $dbh = C4::Context->dbh; > >@@ -430,7 +431,7 @@ my $cookieitemrecord; > if ($prefillitem) { > my $lastitemcookie = $input->cookie('LastCreatedItem'); > if ($lastitemcookie) { >- $lastitemcookie = uri_unescape($lastitemcookie); >+ $lastitemcookie = decode_base64url($lastitemcookie); > eval { > if ( thaw($lastitemcookie) ) { > $cookieitemrecord = thaw($lastitemcookie); >@@ -439,7 +440,7 @@ if ($prefillitem) { > }; > if ($@) { > $lastitemcookie = 'undef' unless $lastitemcookie; >- warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '$lastitemcookie'. Caught error follows: '$@'"; >+ warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '".encode_base64url($lastitemcookie)."'. Caught error follows: '$@'"; > } > } > } >@@ -495,8 +496,8 @@ if ($op eq "additem") { > if ($prefillitem && defined $record) { > my $itemcookie = $input->cookie( > -name => 'LastCreatedItem', >- # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems >- -value => uri_escape_utf8( freeze( $record ) ), >+ # We encode_base64url the whole freezed structure so we're sure we won't have any encoding problems >+ -value => encode_base64url( freeze( $record ) ), > -HttpOnly => 1, > -expires => '' > ); >-- >2.11.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20971
:
76223
|
76224
|
115257
|
115260
|
115332