From 84b64016f3a72a31baca70c4b9f608f023781780 Mon Sep 17 00:00:00 2001 From: Carlgo11 Date: Sat, 18 Nov 2023 02:51:55 +0100 Subject: [PATCH] Raise error on duplicate images --- tests/validate_images.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/validate_images.rb b/tests/validate_images.rb index 3f8803c..d514ff4 100755 --- a/tests/validate_images.rb +++ b/tests/validate_images.rb @@ -27,9 +27,14 @@ def alternative_src(image) domain = File.basename(file, '.*') img = website['img'] || "#{domain}.svg" path = "icons/#{img[0]}/#{img}" - unless File.exist?(path) || alternative_src(img) + exists_locally = File.exist?(path) + exists_remotely = alternative_src(img) + if exists_locally || exists_remotely + error(file, 'Image already exists in 2fa.directory.') unless exists_locally ^ exists_remotely + else error(file, "Image does not exist for #{domain} - #{path} cannot be found.") end + if website['img'].eql?("#{domain}.svg") error(file, "Defining the img property for #{domain} is not necessary. #{img} is the default value.") end