Skip to content

Commit 1a6cdf6

Browse files
authored
fix(helpers): encode index_name properly (#497)
1 parent 007ee65 commit 1a6cdf6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/algolia/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_option(hash, key)
4444
def path_encode(path, *args)
4545
arguments = []
4646
args.each do |arg|
47-
arguments.push(CGI.escape(CGI.unescape(arg.to_s)))
47+
arguments.push(CGI.escape(arg.to_s))
4848
end
4949

5050
format(path, *arguments)

test/algolia/unit/helpers_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def test_deserialize_settings_with_string
4040
deserialized_settings = deserialize_settings(old_settings, false)
4141
assert_equal new_settings, deserialized_settings
4242
end
43+
44+
def test_path_encode
45+
assert_equal path_encode('/1/indexes/%s/settings', 'premium+ some_name'), '/1/indexes/premium%2B+some_name/settings'
46+
end
4347
end
4448

4549
describe 'test hash_includes_subset' do

0 commit comments

Comments
 (0)