gorilla / sessions

Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
https://gorilla.github.io
BSD 3-Clause "New" or "Revised" License
2.93k stars 371 forks source link

FileStorage erase session fix #237

Closed mariusor closed 3 years ago

mariusor commented 3 years ago

Summary of Changes

Don't consider "oserror.ErrNotExist" as a failure when trying to erase a session which corresponds to a missing file.


Hello, in the current implementation if a request contains a session token that has been stored in a file that has been deleted the and we're trying to erase it using the Options.MaxAge = -1 workaround, the action still fails, because the missing file error gets propagated higher in the stack.

This small fix prevents this, and ensures that the session is regenerated.

Please let me know if you have any feedback. Having this merged would help tremendously with one of the projects I'm working on.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.