cloudfiles 1.4.11 → 1.4.12

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTORS CHANGED
@@ -26,3 +26,4 @@ Ryan Williams
26
26
  drue
27
27
  mkcode
28
28
  megaphone
29
+ Nugroho Herucahyono
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.11
1
+ 1.4.12
data/cloudfiles.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cloudfiles}
8
- s.version = "1.4.11"
8
+ s.version = "1.4.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["H. Wade Minter", "Rackspace Hosting"]
12
- s.date = %q{2011-02-05}
12
+ s.date = %q{2011-02-15}
13
13
  s.description = %q{A Ruby version of the Rackspace Cloud Files API.}
14
14
  s.email = %q{minter@lunenburg.org}
15
15
  s.extra_rdoc_files = [
data/lib/cloudfiles.rb CHANGED
@@ -50,8 +50,8 @@ module CloudFiles
50
50
  end
51
51
 
52
52
  # CGI.escape, but without special treatment on spaces
53
- def self.escape(str)
54
- str.gsub(/([^a-zA-Z0-9_.-]+)/) do
53
+ def self.escape(str,extra_exclude_chars = '')
54
+ str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
55
55
  '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
56
56
  end
57
57
  end
@@ -25,7 +25,7 @@ module CloudFiles
25
25
  raise CloudFiles::Exception::Connection, "Unable to connect to #{server}"
26
26
  end
27
27
  response = server.get(path, hdrhash)
28
- if (response.code == "204")
28
+ if (response.code =~ /^20./)
29
29
  if response["x-cdn-management-url"]
30
30
  connection.cdnmgmthost = URI.parse(response["x-cdn-management-url"]).host
31
31
  connection.cdnmgmtpath = URI.parse(response["x-cdn-management-url"]).path
@@ -85,7 +85,7 @@ module CloudFiles
85
85
  @snet = ENV['RACKSPACE_SERVICENET'] || options[:snet]
86
86
  @proxy_host = options[:proxy_host]
87
87
  @proxy_port = options[:proxy_port]
88
- elsif args[0].is_a?(String)
88
+ else
89
89
  @authuser = args[0] ||( raise CloudFiles::Exception::Authentication, "Must supply the username as the first argument")
90
90
  @authkey = args[1] || (raise CloudFiles::Exception::Authentication, "Must supply the API key as the second argument")
91
91
  @retry_auth = args[2] || true
@@ -21,7 +21,7 @@ module CloudFiles
21
21
  @name = objectname
22
22
  @make_path = make_path
23
23
  @storagehost = self.container.connection.storagehost
24
- @storagepath = self.container.connection.storagepath + "/#{CloudFiles.escape @containername}/#{CloudFiles.escape @name}"
24
+ @storagepath = self.container.connection.storagepath + "/#{CloudFiles.escape @containername}/#{CloudFiles.escape @name, '/'}"
25
25
  @storageport = self.container.connection.storageport
26
26
  @storagescheme = self.container.connection.storagescheme
27
27
  if force_exists
@@ -249,7 +249,7 @@ module CloudFiles
249
249
  # private_object.public_url
250
250
  # => nil
251
251
  def public_url
252
- self.container.public? ? self.container.cdn_url + "/#{CloudFiles.escape @name}" : nil
252
+ self.container.public? ? self.container.cdn_url + "/#{CloudFiles.escape @name, '/'}" : nil
253
253
  end
254
254
 
255
255
  # Copy this object to a new location (optionally in a new container)
@@ -275,7 +275,7 @@ module CloudFiles
275
275
  new_name.sub!(/^\//,'')
276
276
  headers = {'X-Copy-From' => "#{self.container.name}/#{self.name}", 'Content-Type' => self.content_type.sub(/;.+/, '')}.merge(new_headers)
277
277
  # , 'Content-Type' => self.content_type
278
- new_path = self.container.connection.storagepath + "/#{CloudFiles.escape new_container}/#{CloudFiles.escape new_name}"
278
+ new_path = self.container.connection.storagepath + "/#{CloudFiles.escape new_container}/#{CloudFiles.escape new_name, '/'}"
279
279
  response = self.container.connection.cfreq("PUT", @storagehost, new_path, @storageport, @storagescheme, headers)
280
280
  code = response.code
281
281
  raise CloudFiles::Exception::InvalidResponse, "Invalid response code #{response.code}" unless (response.code =~ /^20/)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfiles
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 11
10
- version: 1.4.11
9
+ - 12
10
+ version: 1.4.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - H. Wade Minter
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-05 00:00:00 -05:00
19
+ date: 2011-02-15 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency