From 5b9739c37e2663992e69033068ef6caa4312320e Mon Sep 17 00:00:00 2001 From: Skylar Challand Date: Mon, 14 Sep 2020 23:45:58 -0400 Subject: [PATCH] escape square brackets in URI workaround for https://bugs.ruby-lang.org/issues/12235 --- lib/siteleaf/source_file.rb | 6 ++++-- lib/siteleaf/version.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/siteleaf/source_file.rb b/lib/siteleaf/source_file.rb index 9d5ebc6..dd1a9e2 100644 --- a/lib/siteleaf/source_file.rb +++ b/lib/siteleaf/source_file.rb @@ -5,7 +5,9 @@ class SourceFile < Entity attr_reader :name, :url, :download_url, :type, :filesize, :sha, :created_at, :updated_at, :user_id def create_endpoint - ::File.join("sites", site_id, "source", URI.escape(identifier)) + uri = URI.encode(identifier) + uri = uri.gsub('[', '%5B').gsub(']', '%5D') # workaround for https://bugs.ruby-lang.org/issues/12235 + ::File.join('sites', site_id, 'source', uri) end def entity_endpoint @@ -17,7 +19,7 @@ def identifier end def to_file - Client.get(::File.join("sites", site_id, "source", "#{URI.escape(identifier)}?download")) + Client.get("#{entity_endpoint}?download") end end diff --git a/lib/siteleaf/version.rb b/lib/siteleaf/version.rb index 42b7eee..a6d7b22 100644 --- a/lib/siteleaf/version.rb +++ b/lib/siteleaf/version.rb @@ -1,3 +1,3 @@ module Siteleaf - VERSION = "2.1.0" + VERSION = "2.1.1" end