Skip to content

Git::Lib#escape does not work, escapes incorrectly #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tadman opened this issue Nov 12, 2009 · 0 comments
Closed

Git::Lib#escape does not work, escapes incorrectly #5

tadman opened this issue Nov 12, 2009 · 0 comments
Milestone

Comments

@tadman
Copy link

tadman commented Nov 12, 2009

The escape mechanism for handling filenames with single quotes in them is repeating text, not escaping at all.

s = "it's"
# Original
escaped = s.to_s.gsub('\'', '\'\\\'\'') # => "it's's"
%Q{"#{escaped}"} #=> "\"it's's\""

# Patched
%Q{"#{s.to_s.gsub("'") { "\\'" }}"} # => "\"it\\'s\""

Looks like gsub placeholders are kicking in accidentally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant