chore: set max local storage value length is 2kb

pull/224/head
moonD4rk 2 years ago
parent 4fb2acd85c
commit a685be362b
  1. 8
      browingdata/localstorage/localstorage.go

@ -26,7 +26,7 @@ type storage struct {
Value string Value string
} }
const maxLocalStorageLength = 1024 * 2 const maxLocalStorageValueLength = 1024 * 2
func (c *ChromiumLocalStorage) Parse(masterKey []byte) error { func (c *ChromiumLocalStorage) Parse(masterKey []byte) error {
db, err := leveldb.OpenFile(item.TempChromiumLocalStorage, nil) db, err := leveldb.OpenFile(item.TempChromiumLocalStorage, nil)
@ -42,11 +42,11 @@ func (c *ChromiumLocalStorage) Parse(masterKey []byte) error {
value := iter.Value() value := iter.Value()
s := new(storage) s := new(storage)
s.fillKey(key) s.fillKey(key)
// don't all value upper than 1kB // don't all value upper than 2KB
if len(value) < maxLocalStorageLength { if len(value) < maxLocalStorageValueLength {
s.fillValue(value) s.fillValue(value)
} else { } else {
s.Value = fmt.Sprintf("value is too long, length is %d, supportted max length is %d", len(value), maxLocalStorageLength) s.Value = fmt.Sprintf("value is too long, length is %d, supportted max length is %d", len(value), maxLocalStorageValueLength)
} }
if s.IsMeta { if s.IsMeta {
s.Value = fmt.Sprintf("meta data, value bytes is %v", value) s.Value = fmt.Sprintf("meta data, value bytes is %v", value)

Loading…
Cancel
Save