Skip to content
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

Fix OpenStack.escape with dash/extra characters #526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant