Fixed pagination parsing for non-numeric IDs
Mastodon API's pagination IDs are not guaranteed to be in a numeric format. This happens to be the case for the tootsuite implementation, but others use UUIDs or flake IDs for pagination. This also simplifies the code a bit and luckily shouldn't break backwards compatibility since they're already of type ID in the Pagination struct.
This commit is contained in:
parent
f51571807d
commit
c09198f7c9
2 changed files with 5 additions and 16 deletions
13
mastodon.go
13
mastodon.go
|
@ -14,7 +14,6 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -352,17 +351,7 @@ func getPaginationID(rawurl, key string) (ID, error) {
|
|||
return "", err
|
||||
}
|
||||
|
||||
val := u.Query().Get(key)
|
||||
if val == "" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
id, err := strconv.ParseInt(val, 10, 64)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return ID(fmt.Sprint(id)), nil
|
||||
return ID(u.Query().Get(key)), nil
|
||||
}
|
||||
|
||||
func (p *Pagination) toValues() url.Values {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue