Skip to content

Commit f6fb287

Browse files
author
Puneet Khushwani
committed
added check of 'v' in api version in regex
1 parent 6f5299f commit f6fb287

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

lib/ost-sdk-ruby/saas/services.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ def extract_integer_api_version(api_base_url)
5252
api_version = ((api_base_url || '').split("/")[3] || '').downcase
5353
return v0_int_api_version if api_version == ''
5454

55-
# version if passed should always start with 'v'
56-
fail "invalid version string #{api_version}" if api_version[0] != 'v'
57-
58-
# exclude 'v'
59-
str_api_version = api_version[1..-1]
60-
61-
regex_match_rsp = /^(\d{1,3})\.?(\d{0,3})\.?(\*|\d{0,3})$/.match(str_api_version)
55+
regex_match_rsp = /^v(\d{1,3})\.?(\d{0,3})\.?(\*|\d{0,3})$/.match(api_version)
6256
fail "invalid version string #{api_version}" if regex_match_rsp.nil?
6357

6458
int_api_version = 0

0 commit comments

Comments
 (0)