Skip to content

FilesystemStore doesn’t truncate session files #1

Closed
@moraes

Description

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions