admin: Fix file download from admin interface
This commit is contained in:
parent
9bcf4a481e
commit
abb277210c
2 changed files with 7 additions and 1 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
@ -33,6 +35,10 @@ func NewApp(cfg *settings.Settings, baseURL string, bind string) App {
|
|||
router.GET("/", func(c *gin.Context) {
|
||||
c.Redirect(http.StatusFound, baseURL)
|
||||
})
|
||||
router.GET(filepath.Dir(baseURL)+"/files/*_", func(c *gin.Context) {
|
||||
path := c.Request.URL.Path
|
||||
c.Redirect(http.StatusFound, filepath.Join(baseURL, strings.TrimPrefix(path, filepath.Dir(baseURL))))
|
||||
})
|
||||
|
||||
baserouter = router.Group(baseURL)
|
||||
|
||||
|
|
|
|||
Reference in a new issue