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

Add NE to the ansible api rewrite rule #114

Merged

Conversation

carbonin
Copy link
Member

Because we are proxying requests we don't want to re-encode already
URI encoded values.

Before this change, queries to the API like this:
api.activity_stream.all(timestamp__gt: '2000-01-01 12:12')

ended up with URLs like this:
/ansibleapi/v1/activity_stream?timestamp__gt=2000-01-01+12%3A12

which were then redirected to a URL which re-encodes the % character:
/ansibleapi/v1/activity_stream/?timestamp__gt=2000-01-01+12%253A12

This resulted in an invalid date format when un-encoded: 2000-01-01 12%3A12

ref:
ManageIQ/manageiq#14279
ManageIQ/manageiq#14296

/cc @durandom

Because we are proxying requests we don't want to re-encode already
URI encoded values.

Before this change, queries to the API like this:
`api.activity_stream.all(timestamp__gt: '2000-01-01 12:12')`

ended up with URLs like this:
`/ansibleapi/v1/activity_stream?timestamp__gt=2000-01-01+12%3A12`

which were then redirected to a URL which re-encodes the `%` character:
`/ansibleapi/v1/activity_stream/?timestamp__gt=2000-01-01+12%253A12`

This resulted in an invalid date format when un-encoded: `2000-01-01 12%3A12`

ref:
ManageIQ/manageiq#14279
ManageIQ/manageiq#14296
Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it manually on an QE appliance 👍

@durandom
Copy link
Member

this is a reproducer in the rails console

ExtManagementSystem.first.connect.api.activity_stream.all(timestamp__gt: '2000-01-01 12:12').count

Copy link
Member

@bdunne bdunne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@miq-bot
Copy link
Member

miq-bot commented Mar 22, 2017

Checked commit carbonin@8a95682 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
0 files checked, 0 offenses detected
Everything looks good. 🍰

@carbonin carbonin assigned jrafanie and unassigned abellotti Mar 22, 2017
Copy link
Member

@jrafanie jrafanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that was simple.

@jrafanie jrafanie merged commit daf5812 into ManageIQ:master Mar 22, 2017
@jrafanie jrafanie added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 22, 2017
@carbonin carbonin deleted the add_no_escape_to_ansible_rewrite_rule branch May 18, 2017 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants