Skip to content

Commit dd3588a

Browse files
committed
Fix symbol use
1 parent 63efbe2 commit dd3588a

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

templates/ruby/lib/container/client.rb.twig

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,17 @@ module {{ spec.title | caseUcfirst }}
120120
end
121121

122122
offset = 0
123-
123+
id_param_name = id_param_name.to_sym if id_param_name
124124
if id_param_name&.empty? == false && params[id_param_name] != "unique()"
125125
# Make a request to check if a file already exists
126-
begin
127-
current = call(
128-
method: "GET",
129-
path: "#{path}/#{params[id_param_name]}",
130-
headers: headers,
131-
params: {}
132-
)
133-
chunks_uploaded = current["chunksUploaded"].to_i
134-
offset = [size, (chunks_uploaded * CHUNK_SIZE)].min
135-
rescue {{spec.title | caseUcfirst}}::Exception
136-
# File does not exist, start upload with 0 offset
137-
end
126+
current = call(
127+
method: "GET",
128+
path: "#{path}/#{params[id_param_name]}",
129+
headers: headers,
130+
params: {}
131+
)
132+
chunks_uploaded = current['chunksUploaded'].to_i
133+
offset = [size, (chunks_uploaded * @chunk_size)].min
138134
end
139135

140136
while offset < size
@@ -160,8 +156,8 @@ module {{ spec.title | caseUcfirst }}
160156
id: result['$id'],
161157
progress: ([offset, size].min).to_f/size.to_f * 100.0,
162158
size_uploaded: [offset, size].min,
163-
chunks_total: result['chunks_total'],
164-
chunks_uploaded: result['chunks_uploaded']
159+
chunks_total: result['chunksTotal'],
160+
chunks_uploaded: result['chunksUploaded']
165161
}) unless on_progress.nil?
166162
end
167163

0 commit comments

Comments
 (0)