~sircmpwn/meta.sr.ht

3693c41f0fdcfe9f5df6dc4e01fd1622f6975e88 — Drew DeVault 2 months ago fb53585 0.56.20
API: Fix nil dereference on URL validation error
1 files changed, 3 insertions(+), 2 deletions(-)

M api/graph/schema.resolvers.go
M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +3 -2
@@ 68,11 68,12 @@ func (r *mutationResolver) UpdateUser(ctx context.Context, input map[string]inte
		valid.
			Expect(err == nil, "URL does not pass validation").
			WithField("url").
			And(url.Host != "" && (url.Scheme == "http" ||
			And(url == nil || // Prevents nil dereference if Expect failed
				(url.Host != "" && (url.Scheme == "http" ||
				url.Scheme == "https" ||
				url.Scheme == "gopher" ||
				url.Scheme == "gemini" ||
				url.Scheme == "finger"),
				url.Scheme == "finger")),
				"URL must have a host and a permitted scheme").
			WithField("url")
	})