fog-openstack
fog-openstack copied to clipboard
Fix `OpenStack.escape` with dash/extra characters
There is a bug in the regexp used in OpenStack.escape in that when
extra_exclude_chars is set, dash is no longer the last character in
the pattern.
This causes the regexp to treat it as a range, not a character of its own and that causes it to be escaped.
# Before
Fog::OpenStack.escape("test-pattern/", "/") # => "test%2Dpattern/"
Fog::OpenStack.escape("test-pattern/") # => "test-pattern%2F"
# After
Fog::OpenStack.escape("test-pattern/", "/") # => "test-pattern/"
It does not happen when extra_exclude_chars is blank.
We spotted this in our Brightbox provider which was forked from the OpenStack implementation. It appears to have been fixed in Rackspace for a few years and copied into Google provider.