summaryrefslogtreecommitdiff
path: root/internal/web/customcss.go
diff options
context:
space:
mode:
authorLibravatar Natsu Kagami <natsukagami@gmail.com>2023-05-12 08:16:41 +0000
committerLibravatar GitHub <noreply@github.com>2023-05-12 10:16:41 +0200
commitba5a464ca5d3fcbd171c174a4f07c3326ecb01df (patch)
tree4289873a2fef9a9b102fb692b0cf6d3409a41747 /internal/web/customcss.go
parentuse more semantic headers for profile page (#1765) (diff)
downloadgotosocial-ba5a464ca5d3fcbd171c174a4f07c3326ecb01df.tar.xz
[chore] Prefer JSON errors in API endpoints (#1766)
* Default to JSON over HTML for error handling * Change the default error display for web endpoints to html
Diffstat (limited to 'internal/web/customcss.go')
-rw-r--r--internal/web/customcss.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/web/customcss.go b/internal/web/customcss.go
index aaeb269df..ef57e0033 100644
--- a/internal/web/customcss.go
+++ b/internal/web/customcss.go
@@ -33,12 +33,12 @@ const textCSSUTF8 = string(apiutil.TextCSS + "; charset=utf-8")
func (m *Module) customCSSGETHandler(c *gin.Context) {
if !config.GetAccountsAllowCustomCSS() {
err := errors.New("accounts-allow-custom-css is not enabled on this instance")
- apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1)
+ apiutil.WebErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1)
return
}
if _, err := apiutil.NegotiateAccept(c, apiutil.TextCSS); err != nil {
- apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1)
+ apiutil.WebErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1)
return
}
@@ -46,13 +46,13 @@ func (m *Module) customCSSGETHandler(c *gin.Context) {
username := strings.ToLower(c.Param(usernameKey))
if username == "" {
err := errors.New("no account username specified")
- apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
+ apiutil.WebErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
return
}
customCSS, errWithCode := m.processor.Account().GetCustomCSSForUsername(c.Request.Context(), username)
if errWithCode != nil {
- apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
+ apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}