Skip to content

Commit 54c67e3

Browse files
committed
fix: danbooru
1 parent 61168ad commit 54c67e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugin/danbooru/tag.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package deepdanbooru
33
import (
44
"bytes"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"image"
89
"net/url"
@@ -59,8 +60,12 @@ func tagurl(name, u string) (im image.Image, st *sorttags, err error) {
5960
if err != nil {
6061
return
6162
}
63+
if len(data) < 4 {
64+
err = errors.New("data too short")
65+
return
66+
}
6267
tags := make(map[string]float64)
63-
err = json.Unmarshal(data, &tags)
68+
err = json.Unmarshal(data[1:len(data)-1], &tags)
6469
if err != nil {
6570
return
6671
}

0 commit comments

Comments
 (0)