From 4f4f7ac6e20e66e2691f26b3f537c06d3f8c2e22 Mon Sep 17 00:00:00 2001 From: Failure Date: Thu, 8 Aug 2024 23:17:06 -0700 Subject: [PATCH] isolate signature in images --- processor.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/processor.go b/processor.go index 187c0b0..94f3847 100644 --- a/processor.go +++ b/processor.go @@ -83,7 +83,8 @@ func subThumbnail(url string) string { Height: 400, } path := imagorpath.Generate(params, imagorpath.NewHMACSigner(sha256.New, 0, key)) - return path + signature := path[:strings.IndexByte(path, '/')] + return signature } // Process implements imagor.Processor interface @@ -156,7 +157,8 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp case "og:image": fallthrough case "twitter:image:src": - meta.Image = subThumbnail(val) + meta.ImageSignature = subThumbnail(val) + meta.Image = val break case "og:title": @@ -190,6 +192,7 @@ type Metadata struct { Title string `json:"title"` Description string `json:"description"` Image string `json:"image"` + ImageSignature string `json:"image_signature"` Hostname string `json:"hostname"` SpecialHandler string `json:"special_handler"` SpecialData map[string]string `json:"special_data"`