-
Notifications
You must be signed in to change notification settings - Fork 727
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
base: main
Are you sure you want to change the base?
Conversation
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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fix!
There was a problem hiding this 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?
Example CHANGELOG entry:
|
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.