Fix proxying unsplash images (security)
This commit is contained in:
parent
03ef48a0ae
commit
d8a6acda96
1 changed files with 3 additions and 1 deletions
|
@ -20,10 +20,12 @@ import (
|
||||||
"code.vikunja.io/web/handler"
|
"code.vikunja.io/web/handler"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func unsplashImage(url string, c echo.Context) error {
|
func unsplashImage(url string, c echo.Context) error {
|
||||||
resp, err := http.Get(url)
|
// Replacing and appending the url for security reasons
|
||||||
|
resp, err := http.Get("https://images.unsplash.com/" + strings.Replace(url, "https://images.unsplash.com/", "", 1))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue