mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-09 00:47:28 -06:00
media handler updates
This commit is contained in:
parent
d797ddf704
commit
17a62d53ed
15 changed files with 237 additions and 55 deletions
|
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
// MediaGETHandler allows the owner of an attachment to get information about that attachment before it's used in a status.
|
||||
func (m *Module) MediaGETHandler(c *gin.Context) {
|
||||
l := m.log.WithField("func", "statusCreatePOSTHandler")
|
||||
l := m.log.WithField("func", "MediaGETHandler")
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
l.Debugf("couldn't auth: %s", err)
|
||||
|
|
@ -35,14 +35,14 @@ func (m *Module) MediaGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
attachmentID := c.GetString(IDKey)
|
||||
attachmentID := c.Param(IDKey)
|
||||
if attachmentID == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "no attachment ID given in request"})
|
||||
return
|
||||
}
|
||||
|
||||
attachment, errWithCode := m.processor.MediaGet(authed, attachmentID)
|
||||
if err != nil {
|
||||
if errWithCode != nil {
|
||||
c.JSON(errWithCode.Code(),gin.H{"error": errWithCode.Safe()})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue