Skip to content

Commit

Permalink
add extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorehig committed Nov 19, 2024
1 parent a155b30 commit 1dc1b5b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion middleware/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,18 @@
return null
}

let item = null;

try {
const item = JSON.parse(serializedItem)
item = JSON.parse(serializedItem)
} catch (error) {
return null
}

if(typeof item !== 'object' || item === null) {
return null
}

const now = new Date()

if (now.getTime() > item.expiry) {
Expand Down

0 comments on commit 1dc1b5b

Please sign in to comment.