Skip to content

Commit

Permalink
fix: bad cookies can crash process
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Beaurain committed Jan 9, 2017
1 parent 8b7e75a commit 13f3fa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/routes/get-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function renderAbeAdmin(EditorVariables, obj, filePath) {
var editorWidth = '33%'
EditorVariables.express.req.headers && EditorVariables.express.req.headers.cookie && EditorVariables.express.req.headers.cookie.split(';').forEach(function(cookie) {
var parts = cookie.match(/(.*?)=(.*)$/)
if(parts[1] === 'editorWidth') editorWidth = parts[2]
if ( parts && ( parts.length > 2 ) && ( parts[1] === 'editorWidth' ) ) editorWidth = parts[2]
})

EditorVariables.pageHtml = pageHtml
Expand Down Expand Up @@ -173,4 +173,4 @@ var route = function(req, res, next) {
})
}

export default route
export default route

0 comments on commit 13f3fa1

Please sign in to comment.