Skip to content

Commit

Permalink
Use proper escape
Browse files Browse the repository at this point in the history
  • Loading branch information
syrnick committed Nov 15, 2016
1 parent e4fd408 commit 3cc21ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/airtable/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ def result_attributes(res)
end

def worksheet_url
"/#{app_token}/#{CGI.escape(worksheet_name)}"
"/#{app_token}/#{url_encode(worksheet_name)}"
end

# From http://apidock.com/ruby/ERB/Util/url_encode
def url_encode(s)
s.to_s.dup.force_encoding("ASCII-8BIT").gsub(/[^a-zA-Z0-9_\-.]/) {
sprintf("%%%02X", $&.unpack("C")[0])
}
end
end # Table

Expand Down
2 changes: 1 addition & 1 deletion lib/airtable/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Airtable
VERSION = "0.1.0"
VERSION = "0.1.1"
end

0 comments on commit 3cc21ea

Please sign in to comment.