Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1675 from ajaxorg/session-fix

Session fix
  • Loading branch information...
commit 6d88db389dc713e96c6783b76b103189059ad7eb 2 parents 4bde320 + b924926
@gjtorikian gjtorikian authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 plugins-server/cloud9.session.file/session-ext.js
View
12 plugins-server/cloud9.session.file/session-ext.js
@@ -48,7 +48,17 @@ var FileStore = function(options) {
console.error(err);
return;
}
- var sess = JSON.parse(data);
+ if (data.toString() === "") {
+ self.destroy(file);
+ return;
+ }
+ var sess;
+ try {
+ sess = JSON.parse(data);
+ } catch(err) {
+ console.warn("Error '" + err + "' while reading session from file: " + self.basePath + "/" + file);
+ return;
+ }
var expires = (typeof sess.cookie.expires === 'string')
? new Date(sess.cookie.expires)
: sess.cookie.expires;
Please sign in to comment.
Something went wrong with that request. Please try again.