etna 0.1.48 → 0.1.49

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aea22f69c338ad0b9b7a580ed1e5f91b4d8166c2ab129ed371f5a17b273aab80
4
- data.tar.gz: fcd7e348f3620f267763a3206e8f47663a1d10ce839e00dfdecab214f78fc79a
3
+ metadata.gz: 4e6abb600dd6cd4dd0986021317933f8b782b94f03d30315383bc74b052613ab
4
+ data.tar.gz: 909e5c67319a91dd11db4d081ec721f9438b13b8fb15dbc9d19cef2e5a5197b1
5
5
  SHA512:
6
- metadata.gz: 38ad3b89bef7df3f92370b4adaf5eed503321149ca9f33c8b20d08c0d27d7bf7deaf9511d6582943e4ed1d53aaea7fdf06520473acdab1c94ddf4996526e8f61
7
- data.tar.gz: 5d60ee51a5fea1580739ac1d83827dc241ca58aa0e5446a4715872a89a5c7bdef0c4d9ef9f525713e13b932ae68a269d4acfa629fc817ee23683d0960a9f7e47
6
+ metadata.gz: 4ef5fff5973c32b570306cab9292b7107e16c9f158dc6e3828fb19e6e4d8441f315e075091d39ce13641f81f3ecbdb428f3add61238d9c4043527e6139212702
7
+ data.tar.gz: 66d797cdfc76684f325aa37299e82de323b966f337d3b7e68b5ed8542cc1cb766d6b05c740256c2da63a586d240a8a2dbe9c8a1af9df3b9d0712b1a59f66ef0b
data/lib/etna/client.rb CHANGED
@@ -293,9 +293,9 @@ module Etna
293
293
  status_check!(response)
294
294
  return response
295
295
  end unless block_given?
296
+ else
297
+ raise ::Etna::Error, "Could not contact server, giving up"
296
298
  end
297
-
298
- raise ::Etna::Error, "Could not contact server, giving up" unless block_given?
299
299
  end
300
300
 
301
301
  private
@@ -81,7 +81,7 @@ module Etna
81
81
 
82
82
  upload_timings << [chunk.length, Time.now.to_f]
83
83
  upload_amount += chunk.length
84
- remaining -= chunk.length
84
+ remaining -= chunk.length unless remaining.nil?
85
85
 
86
86
  if upload_timings.length > 150
87
87
  s, _ = upload_timings.shift
@@ -3,6 +3,8 @@ module Etna
3
3
  SIZE_UNITS = %W(B KiB MiB GiB TiB).freeze
4
4
 
5
5
  def self.as_size(number)
6
+ return "unknown" if number.nil?
7
+
6
8
  if number.to_i < 1024
7
9
  exponent = 0
8
10
  else
data/lib/etna/route.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'digest'
2
2
  require 'date'
3
+ require 'net/http'
3
4
  require "addressable/uri"
4
5
  require_relative "./censor"
5
6
  require_relative './instrumentation'
@@ -46,7 +47,7 @@ module Etna
46
47
  if params
47
48
  PARAM_TYPES.reduce(route) do |path,pat|
48
49
  path.gsub(pat) do
49
- params[$1.to_sym].split('/').map { |c| block_given? ? yield(c) : Addressable::URI.normalized_encode(c) }.join('/')
50
+ params[$1.to_sym].split('/').map { |c| block_given? ? yield(c) : Etna::Route.encode_path_component(c) }.join('/')
50
51
  end
51
52
  end
52
53
  else
@@ -54,6 +55,12 @@ module Etna
54
55
  end
55
56
  end
56
57
 
58
+ def self.encode_path_component(path_component)
59
+ form_encoded = URI.encode_www_form_component(path_component)
60
+ # Because of issues #1005, #1006, #1197
61
+ form_encoded.gsub('+', '%20')
62
+ end
63
+
57
64
  def path(params=nil, &block)
58
65
  self.class.path(@route, params, &block)
59
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.48
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saurabh Asthana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-03 00:00:00.000000000 Z
11
+ date: 2023-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack