Disable media streaming

This commit is contained in:
video-prize-ranch 2022-01-28 16:40:21 -05:00
parent cb99714a47
commit 65e5711766
No known key found for this signature in database
GPG Key ID: D8EAA4C5B12A7281
2 changed files with 9 additions and 5 deletions

View File

@ -42,7 +42,7 @@ func init() {
Views: engine, Views: engine,
Prefork: viper.GetBool("FIBER_PREFORK"), Prefork: viper.GetBool("FIBER_PREFORK"),
UnescapePath: true, UnescapePath: true,
StreamRequestBody: true, StreamRequestBody: false,
}) })
app.Use("/static", filesystem.New(filesystem.Config{ app.Use("/static", filesystem.New(filesystem.Config{

View File

@ -1,9 +1,9 @@
package pages package pages
import ( import (
"io/ioutil"
"net/http" "net/http"
"strconv"
"codeberg.org/video-prize-ranch/rimgo/utils" "codeberg.org/video-prize-ranch/rimgo/utils"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@ -32,7 +32,11 @@ func handleMedia(c *fiber.Ctx, url string) error {
return err return err
} }
body, err := ioutil.ReadAll(res.Body)
if err != nil {
return err
}
c.Set("Content-Type", res.Header.Get("Content-Type")); c.Set("Content-Type", res.Header.Get("Content-Type"));
contentLen, _ := strconv.Atoi(res.Header.Get("Content-Length")) return c.Send(body)
return c.SendStream(res.Body, contentLen)
} }