summaryrefslogtreecommitdiff
path: root/internal/api/client/app/appcreate.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-11-03 14:38:06 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-03 14:38:06 +0100
commitbd05040133ec5ce5b431e05d8c873195d9501d6d (patch)
treec1c7a248b31dccf9e768d43efacc14f7f93d553f /internal/api/client/app/appcreate.go
parent[feature] Allow user to show instead of landing page on / (#922) (diff)
downloadgotosocial-bd05040133ec5ce5b431e05d8c873195d9501d6d.tar.xz
[bugfix] Use []rune to check length of user-submitted text (#948)
Diffstat (limited to 'internal/api/client/app/appcreate.go')
-rw-r--r--internal/api/client/app/appcreate.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/api/client/app/appcreate.go b/internal/api/client/app/appcreate.go
index 641357d42..c79c528d9 100644
--- a/internal/api/client/app/appcreate.go
+++ b/internal/api/client/app/appcreate.go
@@ -92,26 +92,26 @@ func (m *Module) AppsPOSTHandler(c *gin.Context) {
return
}
- if len(form.ClientName) > formFieldLen {
- err := fmt.Errorf("client_name must be less than %d bytes", formFieldLen)
+ if len([]rune(form.ClientName)) > formFieldLen {
+ err := fmt.Errorf("client_name must be less than %d characters", formFieldLen)
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
return
}
- if len(form.RedirectURIs) > formRedirectLen {
- err := fmt.Errorf("redirect_uris must be less than %d bytes", formRedirectLen)
+ if len([]rune(form.RedirectURIs)) > formRedirectLen {
+ err := fmt.Errorf("redirect_uris must be less than %d characters", formRedirectLen)
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
return
}
- if len(form.Scopes) > formFieldLen {
- err := fmt.Errorf("scopes must be less than %d bytes", formFieldLen)
+ if len([]rune(form.Scopes)) > formFieldLen {
+ err := fmt.Errorf("scopes must be less than %d characters", formFieldLen)
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
return
}
- if len(form.Website) > formFieldLen {
- err := fmt.Errorf("website must be less than %d bytes", formFieldLen)
+ if len([]rune(form.Website)) > formFieldLen {
+ err := fmt.Errorf("website must be less than %d characters", formFieldLen)
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
return
}