Fix up array error
This commit is contained in:
parent
f80d779b28
commit
746a08a56a
10
main.go
10
main.go
|
@ -88,14 +88,16 @@ func save(raw string, lang string, title string) []string {
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
sha := hash(raw)
|
sha := hash(raw)
|
||||||
query, err := db.Query("select id, hash, data, delkey from pastebin")
|
query, err := db.Query("select id, title hash, data, delkey from pastebin")
|
||||||
for query.Next() {
|
for query.Next() {
|
||||||
var id, hash, paste, delkey string
|
var id, title, hash, paste, delkey string
|
||||||
err := query.Scan(&id, &hash, &paste, &delkey)
|
err := query.Scan(&id, &title, &hash, &paste, &delkey)
|
||||||
check(err)
|
check(err)
|
||||||
if hash == sha {
|
if hash == sha {
|
||||||
url := ADDRESS + "/p/" + id
|
url := ADDRESS + "/p/" + id
|
||||||
return []string{id, hash, url, paste, delkey}
|
if title == "" {
|
||||||
|
return []string{id, title, hash, url, paste, delkey}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
id := generateName()
|
id := generateName()
|
||||||
|
|
Loading…
Reference in New Issue