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

hipchat: escape channel name if it is not escaped yet #5547

Merged
merged 1 commit into from
Jul 29, 2016

Conversation

barbosa
Copy link
Contributor

@barbosa barbosa commented Jul 29, 2016

As mentioned in #302, if you have a channel name with whitespace in it, the action fails:

irb(main):003:0> URI.parse("https://api.hipchat.com/v2/user/Mobile Engineering/message")
URI::InvalidURIError: bad URI(is not URI?): https://api.hipchat.com/v2/user/Mobile Engineering/message
    from /Users/gustavo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:176:in `split'
    from /Users/gustavo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
    from /Users/gustavo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
    from (irb):3
    from /Users/gustavo/.rbenv/versions/2.0.0-p247/bin/irb:12:in `<main>'

The current workaround is to set the channel name as an already escaped string, like Mobile%20Engineering.

This PR checks if the channel name is already escaped (so developers using the workaround won't be affected) and escapes it otherwise.

irb(main):004:0> channel = "Mobile Engineering"
=> "Mobile Engineering"
irb(main):005:0> escaped_channel = URI.unescape(channel) == channel ? URI.escape(channel) : channel
=> "Mobile%20Engineering"
irb(main):006:0> channel = "Mobile%20Engineering"
=> "Mobile%20Engineering"
irb(main):007:0> escaped_channel = URI.unescape(channel) == channel ? URI.escape(channel) : channel
=> "Mobile%20Engineering"

fixes #302

@asfalcone
Copy link
Contributor

@barbosa Thanks 👍

@asfalcone asfalcone merged commit 3cc9408 into fastlane:master Jul 29, 2016
KrauseFx added a commit that referenced this pull request Aug 10, 2016
* [scan] Add automatic detection of derived data path (#5563)
* [fastlane] Summary table show failed action in red (#5672)
* Make download_dsyms work for appletvos (#5642)
* Add easier access to lane context from actions (#5572)
* [Carthage] Add option to pass in specific toolchain
* Updated Actions README to clarify last_git_commit (#5627)
* Fix require for gem jira-ruby (#5605)
* [fastlane] Update spaceship dependency (#5659)
* [fastlane] Fix printing verbose information for PluginFetcher (#5670)
* [fastlane] Update available plugins (#5671)
* [fastlane] Fix plugin search (#5568)
* Update Actions file (#5450)
* Update versions of tools (#5566)
* Improve English in docs output (#5562)
* Update carthage action documentation for the dependancies and toolchain options (#5552)
* [fastlane] Update dependencies (#5553)
* hipchat: escape channel name if it is not escaped yet (#5547)
* Fix typo (#5532)
* Update import_from_git :branch parameter documentation (#5533)
* Update junit_generator to use Helper.gem_path (#5462)
KrauseFx added a commit that referenced this pull request Aug 10, 2016
* [scan] Add automatic detection of derived data path (#5563)
* [fastlane] Summary table show failed action in red (#5672)
* Make download_dsyms work for appletvos (#5642)
* Add easier access to lane context from actions (#5572)
* [Carthage] Add option to pass in specific toolchain
* Updated Actions README to clarify last_git_commit (#5627)
* Fix require for gem jira-ruby (#5605)
* [fastlane] Update spaceship dependency (#5659)
* [fastlane] Fix printing verbose information for PluginFetcher (#5670)
* [fastlane] Update available plugins (#5671)
* [fastlane] Fix plugin search (#5568)
* Update Actions file (#5450)
* Update versions of tools (#5566)
* Improve English in docs output (#5562)
* Update carthage action documentation for the dependancies and toolchain options (#5552)
* [fastlane] Update dependencies (#5553)
* hipchat: escape channel name if it is not escaped yet (#5547)
* Fix typo (#5532)
* Update import_from_git :branch parameter documentation (#5533)
* Update junit_generator to use Helper.gem_path (#5462)
@fastlane fastlane locked and limited conversation to collaborators Feb 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HipChat Action URI
2 participants