Log Message:
-----------
Backporting a fix to the encodeAnswer and decodeAnswer routines
Tags:
----
rel-2-1-patches
Modified Files:
--------------
webwork-modperl/lib/WeBWorK:
Utils.pm
Revision Data
-------------
Index: Utils.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/Utils.pm,v
retrieving revision 1.59.2.1
retrieving revision 1.59.2.2
diff -Llib/WeBWorK/Utils.pm -Llib/WeBWorK/Utils.pm -u -r1.59.2.1 -r1.59.2.2
--- lib/WeBWorK/Utils.pm
+++ lib/WeBWorK/Utils.pm
@@ -648,12 +648,16 @@
$result .= defined $ref ? $ref : '<font color="red">undef</font>';
}
}
-use constant BASE64_ENCODED => 'base64_encoded:';
+our $BASE64_ENCODED = 'base64_encoded:';
+# use constant BASE64_ENCODED = 'base64_encoded;
+# was not evaluated in the matching and substitution
+# statements
sub decodeAnswers($) {
my $string = shift;
return unless defined $string and $string;
- if ($string =~/^BASE64_ENCODED/) {
- $string =~ s/^BASE64_ENCODED//;
+
+ if ($string =~/^$BASE64_ENCODED/o) {
+ $string =~ s/^$BASE64_ENCODED//o;
$string = decode_base64($string);
}
@@ -684,7 +688,7 @@
}
$string =~ s/##$//; # remove last pair of hashs
- $string = BASE64_ENCODED.encode_base64($string);
+ $string = $BASE64_ENCODED.encode_base64($string);
return $string;
}
|