Skip to content

Commit

Permalink
Release 0.6.1 (#105)
Browse files Browse the repository at this point in the history
Fix `BugzillaHelper#bug_id_from_string` failure for string containing url
  • Loading branch information
ShockwaveNN authored Apr 8, 2021
1 parent f4d4cd6 commit 97578d4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ inherit_from: .rubocop_todo.yml

AllCops:
NewCops: enable

Metrics/BlockLength:
Max: 27
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-08-07 08:39:39 UTC using RuboCop version 0.89.0.
# on 2021-04-08 14:51:36 UTC using RuboCop version 1.12.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## master (unreleased)

## 0.6.1 (2021-04-08)

### Fixes

* Fix `BugzillaHelper#bug_id_from_string` failure for string containing url

## 0.6.0 (2021-03-15)

### New Features
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
onlyoffice_bugzilla_helper (0.6.0)
onlyoffice_bugzilla_helper (0.6.1)

GEM
remote: https://rubygems.org/
Expand Down
4 changes: 2 additions & 2 deletions lib/onlyoffice_bugzilla_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def initialize(bugzilla_url: 'https://bugzilla.onlyoffice.com',
# @param string [String] string for error
# @return [Integer, Nil] result of bug id from url
def bug_id_from_string(string)
return nil unless string&.match?(URI::DEFAULT_PARSER.make_regexp)

uri = URI.parse(string)
return nil unless uri.host == url.host
return nil unless uri.path == @show_bug_path
Expand All @@ -44,6 +42,8 @@ def bug_id_from_string(string)
return nil if id.zero?

id
rescue URI::InvalidURIError
nil
end

# Read access token from file system
Expand Down
2 changes: 1 addition & 1 deletion lib/onlyoffice_bugzilla_helper/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module OnlyofficeBugzillaHelper
# [String] version of Gem
VERSION = '0.6.0'
VERSION = '0.6.1'
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
expect(bugzilla.bug_id_from_string(string)).to eq(32_296)
end

it 'bug_id_from_string that contains correct url but contains extra data' do
string = "Junk string #{bugzilla.url}/test?id=32296"
expect(bugzilla.bug_id_from_string(string)).to be_nil
end

it 'bug_id_from_string that looks like correct bugzilla bug url' do
string = "#{bugzilla.url}/test?id=32296"
expect(bugzilla.bug_id_from_string(string)).to be_nil
Expand Down

0 comments on commit 97578d4

Please sign in to comment.