lib/xcflushd/storage_keys.rb in xcflushd-1.0.0.rc2 vs lib/xcflushd/storage_keys.rb in xcflushd-1.0.0

- old
+ new

@@ -78,13 +78,15 @@ end # Returns an array of size 2 with a service and the credentials encoded # given a key marked as 'to be flushed' and its suffix. def service_and_creds(key_to_flush, suffix) - escaped_service, escaped_creds = - key_to_flush.sub("#{KEY_TO_FLUSH_PREFIX}#{REPORT_KEY_PREFIX}", '') - .sub(suffix, '') - .split(/(?<!\\),/) + split_key = key_to_flush.sub("#{KEY_TO_FLUSH_PREFIX}#{REPORT_KEY_PREFIX}", '') + .sub(suffix, '') + .split(/(?<!\\),/) + + escaped_service = split_key.first + escaped_creds = split_key[1..-1].join(','.freeze) # escaped_service is a string with 'service_id:' followed by the escaped # service ID. escaped_creds starts with 'credentials:' and is followed # by the escaped credentials. service = escaped_service