mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 15:03:57 +00:00
Fix: copy the data in buffer instead of using original data. (#1425)
This commit is contained in:
parent
08b2b71197
commit
cd802dfead
@ -160,8 +160,12 @@ func (s *Session) Save() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// pass raw bytes with session id to provider
|
||||
if err := s.config.Storage.Set(s.id, s.byteBuffer.Bytes(), s.exp); err != nil {
|
||||
// copy the data in buffer
|
||||
encodedBytes := make([]byte, s.byteBuffer.Len())
|
||||
copy(encodedBytes, s.byteBuffer.Bytes())
|
||||
|
||||
// pass copied bytes with session id to provider
|
||||
if err := s.config.Storage.Set(s.id, encodedBytes, s.exp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user