From a6ab9a9f7b273813d509c81d4c0f38d56deb6d57 Mon Sep 17 00:00:00 2001 From: Akmal Date: Thu, 4 Jul 2024 11:40:20 +0700 Subject: [PATCH] Poolit --- handlers/embed.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handlers/embed.go b/handlers/embed.go index c0a577e..69b3c66 100644 --- a/handlers/embed.go +++ b/handlers/embed.go @@ -139,9 +139,11 @@ func Embed() fiber.Handler { sb.WriteString("/") sb.WriteString(strconv.Itoa(max(1, mediaNum))) viewsData.VideoURL = sb.String() - descEscaped := make([]byte, 0, len(viewsData.Description)*2) - descEscaped = fasthttp.AppendQuotedArg(descEscaped, utils.S2B(viewsData.Description)) - viewsData.OEmbedURL = c.BaseURL() + "/oembed?text=" + utils.B2S(descEscaped) + "&url=" + viewsData.URL + + descPool := bytebufferpool.Get() + defer bytebufferpool.Put(descPool) + fasthttp.AppendQuotedArg(descPool.B, utils.S2B(viewsData.Description)) + viewsData.OEmbedURL = c.BaseURL() + "/oembed?text=" + utils.B2S(descPool.Bytes()) + "&url=" + viewsData.URL } if direct {