Skip to content

Commit 9280027

Browse files
committed
Fix incorrect compressed value
1 parent 0d92efb commit 9280027

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/controllers/testdata_controller.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,13 @@ def compress_file(f)
148148
tmpfile.flush
149149
nsize = tmpfile.size
150150
tmpfile.close
151-
File.rename tmpfile.path, f.path if nsize < f.size
151+
logger.fatal [nsize, f.size]
152+
if nsize < f.size
153+
File.rename tmpfile.path, f.path
154+
return true
155+
end
152156
end
157+
false
153158
end
154159

155160
def decompress_file(f)
@@ -178,15 +183,13 @@ def testdatum_params
178183
if new_params[:test_input]
179184
new_params[:input_compressed] = false
180185
if new_params[:test_input].size >= COMPRESS_THRESHOLD
181-
compress_file new_params[:test_input]
182-
new_params[:input_compressed] = true
186+
new_params[:input_compressed] = compress_file(new_params[:test_input])
183187
end
184188
end
185189
if new_params[:test_output]
186190
new_params[:output_compressed] = false
187191
if new_params[:test_output].size >= COMPRESS_THRESHOLD
188-
compress_file new_params[:test_output]
189-
new_params[:output_compressed] = true
192+
new_params[:output_compressed] = compress_file(new_params[:test_output])
190193
end
191194
end
192195
new_params

0 commit comments

Comments
 (0)