cask/cask: ensure plist is readable before reading.

If we don't have permissions to read it, this will raise an exception
even although this whole call chain is very tolerant of nil values.
This commit is contained in:
Mike McQuaid 2025-01-14 08:52:20 +00:00
parent 4c9de7d31c
commit 93a9776e34
No known key found for this signature in database

View File

@ -515,7 +515,7 @@ module Cask
sig { returns(T.nilable(Homebrew::BundleVersion)) }
def bundle_version
@bundle_version ||= if (bundle = artifacts.find { |a| a.is_a?(Artifact::App) }&.target) &&
(plist = Pathname("#{bundle}/Contents/Info.plist")) && plist.exist?
(plist = Pathname("#{bundle}/Contents/Info.plist")) && plist.exist? && plist.readable?
Homebrew::BundleVersion.from_info_plist(plist)
end
end