From 18224a06f95747443f5f9c9fc86ebe01d1d3f312 Mon Sep 17 00:00:00 2001
From: RandomChars <random@chars.jp>
Date: Tue, 28 Sep 2021 15:58:58 +0900
Subject: [PATCH] move source URL matching to set

---
 store/image.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/store/image.go b/store/image.go
index c4d3c40..2b5fdfd 100644
--- a/store/image.go
+++ b/store/image.go
@@ -285,7 +285,7 @@ func (s *Store) ImageAdd(data []byte, flake string) Image {
 // ImageUpdate updates image metadata.
 func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslation string) {
 	// Only accept URLs and below 1024 in length
-	if len(source) >= 1024 || !s.MatchURL(source) {
+	if len(source) >= 1024 {
 		return
 	}
 
@@ -306,7 +306,7 @@ func (s *Store) ImageUpdate(hash, source, parent, commentary, commentaryTranslat
 	var msg string
 
 	// Update and save
-	if source != "\000" {
+	if source != "\000" && s.MatchURL(source) {
 		info.Source = source
 		msg += "source"
 	}
-- 
GitLab