Skip to content

Commit

Permalink
Raise error on duplicate images
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlgo11 committed Nov 18, 2023
1 parent 29cb48b commit 84b6401
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/validate_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 84b6401

Please sign in to comment.