diff options
author | 2023-02-02 14:08:13 +0100 | |
---|---|---|
committer | 2023-02-02 14:08:13 +0100 | |
commit | 382512a5a6cc3f13576bbde8d607098d019f4063 (patch) | |
tree | dc2ccd1d30cd65b3f3d576a8d2a6910bbecc593a /internal/api/fileserver/servefile.go | |
parent | [chore/performance] use only 1 sqlite db connection regardless of multiplier ... (diff) | |
download | gotosocial-382512a5a6cc3f13576bbde8d607098d019f4063.tar.xz |
[feature] Implement `/api/v2/instance` endpoint (#1409)
* interim: start adding /api/v2/instance
* finish up
Diffstat (limited to 'internal/api/fileserver/servefile.go')
-rw-r--r-- | internal/api/fileserver/servefile.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/api/fileserver/servefile.go b/internal/api/fileserver/servefile.go index 592d83672..5e36d02a0 100644 --- a/internal/api/fileserver/servefile.go +++ b/internal/api/fileserver/servefile.go @@ -41,7 +41,7 @@ import ( func (m *Module) ServeFile(c *gin.Context) { authed, err := oauth.Authed(c, false, false, false, false) if err != nil { - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1) return } @@ -51,28 +51,28 @@ func (m *Module) ServeFile(c *gin.Context) { accountID := c.Param(AccountIDKey) if accountID == "" { err := fmt.Errorf("missing %s from request", AccountIDKey) - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1) return } mediaType := c.Param(MediaTypeKey) if mediaType == "" { err := fmt.Errorf("missing %s from request", MediaTypeKey) - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1) return } mediaSize := c.Param(MediaSizeKey) if mediaSize == "" { err := fmt.Errorf("missing %s from request", MediaSizeKey) - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1) return } fileName := c.Param(FileNameKey) if fileName == "" { err := fmt.Errorf("missing %s from request", FileNameKey) - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err), m.processor.InstanceGetV1) return } @@ -83,7 +83,7 @@ func (m *Module) ServeFile(c *gin.Context) { FileName: fileName, }) if errWithCode != nil { - apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet) + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) return } @@ -106,7 +106,7 @@ func (m *Module) ServeFile(c *gin.Context) { // attempt to look up the content to provide a preview of the link, and they ask for text/html. format, err := apiutil.NegotiateAccept(c, apiutil.MIME(content.ContentType)) if err != nil { - apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) return } @@ -125,7 +125,7 @@ func (m *Module) ServeFile(c *gin.Context) { if _, err := io.ReadFull(content.Content, b); err != nil && (err != io.ErrUnexpectedEOF && err != io.EOF) { err = fmt.Errorf("ServeFile: error reading from content: %w", err) - apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err, err.Error()), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(err, err.Error()), m.processor.InstanceGetV1) return } @@ -142,7 +142,7 @@ func (m *Module) ServeFile(c *gin.Context) { tfs, err := iotools.TempFileSeeker(r) if err != nil { err = fmt.Errorf("ServeFile: error creating temp file seeker: %w", err) - apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1) return } defer func() { |