Skip to content

Commit

Permalink
Use url escape from fasthttp
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 4, 2024
1 parent a835c77 commit 1610be8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions handlers/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"instafix/utils"
"instafix/views"
"instafix/views/model"
"net/url"
"strconv"
"strings"

Expand All @@ -13,6 +12,7 @@ import (
"github.com/gofiber/fiber/v2"
"github.com/rs/zerolog/log"
"github.com/valyala/bytebufferpool"
"github.com/valyala/fasthttp"
)

func mediaidToCode(mediaID int) string {
Expand Down Expand Up @@ -139,7 +139,8 @@ func Embed() fiber.Handler {
sb.WriteString("/")
sb.WriteString(strconv.Itoa(max(1, mediaNum)))
viewsData.VideoURL = sb.String()
viewsData.OEmbedURL = c.BaseURL() + "/oembed?text=" + url.QueryEscape(viewsData.Description) + "&url=" + url.QueryEscape(viewsData.URL)
descEscaped := fasthttp.AppendQuotedArg(nil, utils.S2B(viewsData.Description))
viewsData.OEmbedURL = c.BaseURL() + "/oembed?text=" + utils.B2S(descEscaped) + "&url=" + viewsData.URL
}

if direct {
Expand Down

0 comments on commit 1610be8

Please sign in to comment.