Skip to content

Conversation

@tokengeek
Copy link
Member

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.

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.
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

Successfully merging this pull request may close these issues.

2 participants