Skip to content

Commit f2fa53b

Browse files
authored
Don't mutate index name when stripping (#433)
Currently calling `init_index` with a frozen string causes a `FrozenError` as the method tries to mutate `index_name`. Using `strip` instead of `strip!` should fix it.
1 parent 2415c48 commit f2fa53b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/algolia/search_client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ def get_task_status(index_name, task_id, opts = {})
9090
# @return [Index] new Index instance
9191
#
9292
def init_index(index_name)
93-
index_name.strip!
94-
if index_name.empty?
93+
stripped_index_name = index_name.strip
94+
if stripped_index_name.empty?
9595
raise AlgoliaError, 'Please provide a valid index name'
9696
end
97-
Index.new(index_name, @transporter, @config)
97+
Index.new(stripped_index_name, @transporter, @config)
9898
end
9999

100100
# List all indexes of the client

0 commit comments

Comments
 (0)