~netlandish/links-dev

links: api: return error when an invalid cursor is given v1 APPLIED

Peter Sanchez: 1
 api: return error when an invalid cursor is given

 2 files changed, 3 insertions(+), 5 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.code.netlandish.com/~netlandish/links-dev/patches/223/mbox | git am -3
Learn more about email & git

[PATCH links] api: return error when an invalid cursor is given Export this patch

Changelog-updated: api will now return an error when an invalid cursor
 is given.
Changelog-updated: api version bumped to 0.11.3
---
Annoying abusers having fun sending me error emails

 api/graph/model/cursor.go     | 6 ++----
 api/graph/schema.resolvers.go | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/api/graph/model/cursor.go b/api/graph/model/cursor.go
index 644c56e..3e04a20 100644
--- a/api/graph/model/cursor.go
+++ b/api/graph/model/cursor.go
@@ -29,10 +29,8 @@ func (c *Cursor) UnmarshalGQL(v any) error {
	if plain == nil || err != nil {
		return fmt.Errorf("Invalid cursor")
	}
	err = json.Unmarshal(plain, c)
	if err != nil {
		// This is guaranteed to be a programming error
		panic(err)
	if err = json.Unmarshal(plain, c); err != nil {
		return fmt.Errorf("Invalid cursor")
	}
	return nil
}
diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index f4990c3..9610a1d 100644
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -5127,7 +5127,7 @@ func (r *queryResolver) Version(ctx context.Context) (*model.Version, error) {
	return &model.Version{
		Major:           0,
		Minor:           11,
		Patch:           2,
		Patch:           3,
		DeprecationDate: nil,
	}, nil
}
-- 
2.52.0
Applied.

To git@git.code.netlandish.com:~netlandish/links
   e4a7eb8..270b525  master -> master