Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilesystemStore doesn’t truncate session files #1

Closed
moraes opened this issue Oct 3, 2012 · 0 comments
Closed

FilesystemStore doesn’t truncate session files #1

moraes opened this issue Oct 3, 2012 · 0 comments

Comments

@moraes
Copy link
Contributor

moraes commented Oct 3, 2012

From http://code.google.com/p/gorilla/issues/detail?id=53

I’m writing a small web-app and I noticed that during testing, I sometimes got the error message

"2012/09/27 15:25:50 session error: securecookie: the value could not be decoded"

…and my session contents were lost.

After a bit of digging, this happens when you write session contents which are smaller than the previous contents.

It can be easily fixed by using os.O_TRUNC in func (s *FilesystemStore) save(session *Session) (sessions/store.go:198):

fp, err2 := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)

Please apply this fix upstream.

Thanks!

@moraes moraes closed this as completed in c044c93 Oct 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant