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

Allow equals signs in values that are set on the fly #557

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

Conversation

aaw
Copy link

@aaw aaw commented May 14, 2015

The current code strips everything after the first equals sign in the value of a variable set on the fly. For example, whenever --set 'a=b=c&d=e' will set a to 'b' and d to 'e'. I noticed this when trying to pass a base64-encoded value that had trailing equals signs which were all stripped off.

This patch fixes this stripping by interpreting everything after the first equals sign in a key-value pair as the value.

The current code strips everything after the first equals sign in the value of
a variable set on the fly. For example, `whenever --set 'a=b=c&d=e'` will set
a to 'b' and d to 'e'. I noticed this when trying to pass a base64-encoded
value that had trailing equals signs which were all stripped off.

This patch fixes this stripping by interpreting everything after the first
equals sign in a key-value pair as the value.
@benlangfeld benlangfeld added this to the 0.10.0 milestone Jun 12, 2016
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

This is a fine fix!

@@ -89,7 +89,7 @@ def pre_set(variable_string = nil)
pairs = variable_string.split('&')
pairs.each do |pair|
next unless pair.index('=')
variable, value = *pair.split('=')
variable, value = *pair.split('=', 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good fix!

Copy link
Collaborator

@benlangfeld benlangfeld left a comment

Choose a reason for hiding this comment

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

Could you add a changelog entry?

@olleolleolle
Copy link
Contributor

olleolleolle commented Dec 14, 2016

Example CHANGELOG entry:

"BUGFIX: support the = sign in variable values configured with set. Previously these dropped the content after the first = sign."

Base automatically changed from master to main January 20, 2021 18:17
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.

None yet

3 participants