From 052092391d643bbc2789c33e2f6dfee0197aa2eb Mon Sep 17 00:00:00 2001 From: WqyJh <781345688@qq.com> Date: Tue, 27 Feb 2024 20:28:07 +0800 Subject: [PATCH] Fix GetImageSizeFromUrl for image url without Content-Type --- common/image/image.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/image/image.go b/common/image/image.go index de8fefd3..f0910d13 100644 --- a/common/image/image.go +++ b/common/image/image.go @@ -16,7 +16,7 @@ import ( ) // Regex to match data URL pattern -var dataURLPattern = regexp.MustCompile(`data:image/([^;]+);base64,(.*)`) +var dataURLPattern = regexp.MustCompile(`data:image/([^;]+);base64,(.*)`) func IsImageUrl(url string) (bool, error) { resp, err := http.Head(url) @@ -30,10 +30,6 @@ func IsImageUrl(url string) (bool, error) { } func GetImageSizeFromUrl(url string) (width int, height int, err error) { - isImage, err := IsImageUrl(url) - if !isImage { - return - } resp, err := http.Get(url) if err != nil { return