Skip to content

Commit

Permalink
cask/cask: ensure plist is readable before reading.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MikeMcQuaid committed Jan 14, 2025
1 parent 4c9de7d commit 93a9776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def artifacts_list(compact: false, uninstall_only: false)
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?

Check warning on line 518 in Library/Homebrew/cask/cask.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/cask.rb#L518

Added line #L518 was not covered by tests
Homebrew::BundleVersion.from_info_plist(plist)
end
end
Expand Down

0 comments on commit 93a9776

Please sign in to comment.