View | Details | Raw Unified | Return to bug 20971
Collapse All | Expand All

(-)a/cataloguing/additem.pl (-5 / +5 lines)
Lines 43-48 use C4::Members; Link Here
43
43
44
use MARC::File::XML;
44
use MARC::File::XML;
45
use URI::Escape;
45
use URI::Escape;
46
use MIME::Base64 qw(decode_base64url encode_base64url);
46
47
47
our $dbh = C4::Context->dbh;
48
our $dbh = C4::Context->dbh;
48
49
Lines 430-436 my $cookieitemrecord; Link Here
430
if ($prefillitem) {
431
if ($prefillitem) {
431
    my $lastitemcookie = $input->cookie('LastCreatedItem');
432
    my $lastitemcookie = $input->cookie('LastCreatedItem');
432
    if ($lastitemcookie) {
433
    if ($lastitemcookie) {
433
        $lastitemcookie = uri_unescape($lastitemcookie);
434
        $lastitemcookie = decode_base64url($lastitemcookie);
434
        eval {
435
        eval {
435
            if ( thaw($lastitemcookie) ) {
436
            if ( thaw($lastitemcookie) ) {
436
                $cookieitemrecord = thaw($lastitemcookie);
437
                $cookieitemrecord = thaw($lastitemcookie);
Lines 439-445 if ($prefillitem) { Link Here
439
        };
440
        };
440
        if ($@) {
441
        if ($@) {
441
            $lastitemcookie = 'undef' unless $lastitemcookie;
442
            $lastitemcookie = 'undef' unless $lastitemcookie;
442
            warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '$lastitemcookie'. Caught error follows: '$@'";
443
            warn "Storable::thaw failed to thaw LastCreatedItem-cookie. Cookie value '".encode_base64url($lastitemcookie)."'. Caught error follows: '$@'";
443
        }
444
        }
444
    }
445
    }
445
}
446
}
Lines 495-502 if ($op eq "additem") { Link Here
495
            if ($prefillitem && defined $record) {
496
            if ($prefillitem && defined $record) {
496
                my $itemcookie = $input->cookie(
497
                my $itemcookie = $input->cookie(
497
                    -name => 'LastCreatedItem',
498
                    -name => 'LastCreatedItem',
498
                    # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
499
                    # We encode_base64url the whole freezed structure so we're sure we won't have any encoding problems
499
                    -value   => uri_escape_utf8( freeze( $record ) ),
500
                    -value   => encode_base64url( freeze( $record ) ),
500
                    -HttpOnly => 1,
501
                    -HttpOnly => 1,
501
                    -expires => ''
502
                    -expires => ''
502
                );
503
                );
503
- 

Return to bug 20971