Skip to content

Commit bf7e4ac

Browse files
committed
Fix exception on invalid cookie store
Fix exception caused by updated codec dependency.
1 parent 0fcdd1c commit bf7e4ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ring-core/src/ring/middleware/session/cookie.clj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@
8787
(defn- unseal
8888
"Retrieve a sealed Clojure data structure from a string"
8989
[key ^String string options]
90-
(let [[data mac] (.split string "--")
91-
data (codec/base64-decode data)]
92-
(if (crypto/eq? mac (hmac key data))
93-
(deserialize (decrypt key data) options))))
90+
(let [[data mac] (.split string "--")]
91+
(if-let [data (try (codec/base64-decode data)
92+
(catch IllegalArgumentException _ nil))]
93+
(if (crypto/eq? mac (hmac key data))
94+
(deserialize (decrypt key data) options)))))
9495

9596
(deftype CookieStore [secret-key options]
9697
SessionStore

0 commit comments

Comments
 (0)