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

Don't propagate "not exist" error if trying to erase a session matchi… #252

Closed mariusor closed 1 year ago

mariusor commented 2 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 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.


This is a reopen of #237 which was closed by the stale bot.

DavidLarsKetch commented 2 years ago

Checks out to me, I recommend this is merged in after #253

mariusor commented 2 years ago

Thank you for the support @DavidLarsKetch :) Are you affiliated with the project in an official capacity?

DavidLarsKetch commented 2 years ago

Not yet, just trying to lend a hand with review. I think @elithrar is still the only one with write permissions.

stale[bot] commented 2 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.

codecov[bot] commented 1 year ago

Codecov Report

Merging #252 (b0eac4a) into main (69327c5) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main     #252   +/-   ##
=======================================
  Coverage   76.86%   76.86%           
=======================================
  Files           4        4           
  Lines         268      268           
=======================================
  Hits          206      206           
  Misses         54       54           
  Partials        8        8           
Files Changed Coverage Δ
store.go 78.01% <0.00%> (ø)
mariusor commented 1 year ago

Whoa! Thank you @coreydaley :partying_face: