mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
Merge pull request #640 from mewtaylor/issue/gh-626-empty-banner
Fix GH-626: Set null contents to null instead of error throw
This commit is contained in:
commit
5976c566cf
1 changed files with 5 additions and 1 deletions
|
@ -15,7 +15,8 @@ var Jar = {
|
|||
// Return the usable content portion of a signed, compressed cookie generated by
|
||||
// Django's signing module
|
||||
// https://github.com/django/django/blob/stable/1.8.x/django/core/signing.py
|
||||
if (!value) return callback('No value to unsign');
|
||||
if (typeof value === 'undefined') return callback(null, value);
|
||||
|
||||
try {
|
||||
var b64Data = value.split(':')[0];
|
||||
var decompress = false;
|
||||
|
@ -78,8 +79,11 @@ var Jar = {
|
|||
// Get a value from a signed object
|
||||
Jar.get(cookieName, function (err, value) {
|
||||
if (err) return callback(err);
|
||||
if (typeof value === 'undefined') return callback(null, value);
|
||||
|
||||
Jar.unsign(value, function (err, contents) {
|
||||
if (err) return callback(err);
|
||||
|
||||
try {
|
||||
var data = JSON.parse(contents);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in a new issue