Merge pull request #17919 from Homebrew/ww/backslash

This commit is contained in:
Rylan Polster 2024-07-31 12:25:47 -04:00 committed by GitHub
commit 278bd2f1c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ class Sandbox
# @api private
sig { params(path: T.any(String, Pathname), type: Symbol).returns(String) }
def path_filter(path, type)
invalid_char = ['"', "'", "(", ")", "\n"].find do |c|
invalid_char = ['"', "'", "(", ")", "\n", "\\"].find do |c|
path.to_s.include?(c)
end
raise ArgumentError, "Invalid character #{invalid_char} in path: #{path}" if invalid_char

View File

@ -22,7 +22,7 @@ RSpec.describe Sandbox, :needs_macos do
end
describe "#path_filter" do
["'", '"', "(", ")", "\n"].each do |char|
["'", '"', "(", ")", "\n", "\\"].each do |char|
it "fails if the path contains #{char}" do
expect do
sandbox.path_filter("foo#{char}bar", :subpath)