[bug] store.New() returns error "no such file or directory"
MichaelHipp opened this issue · 2 comments
Describe the bug
When attempting to create a new session for a fresh login, I call
sess, err := store.New(r, SESS_NAME_USER)
The store is a FilesystemStore
. I noticed that when the browser is sending a never before seen (i.e. invalid) cookie, the New()
call returns an error of open .sessions/session_TSX5KHES...: no such file or directory
. If this is intended to be a new session, isn't it not being found the expected state? Seems it would more likely be an error if it actually was found.
I would think what is desired is for it to create an entirely new session and ignore the existing session being sent by the browser.
It's not a bug, it's the intended behaviour, I think. store.New
and store.Get
are basically the same. Just ignore the error and call session.IsNew to determine if the session is new.
Correct - this is intended. Happy to accept a documentation PR if you think it would make usage clearer.