Skip to content

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

@tadman

Description

@tadman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions