This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new bb68199 Localise the size check
bb68199 is described below
commit bb681991fd24a85f382b27b1272a76f8dc74bcfb
Author: Sebb <[email protected]>
AuthorDate: Fri Mar 13 16:55:58 2020 +0000
Localise the size check
---
.../workbench/views/actions/check-signature.json.rb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/www/secretary/workbench/views/actions/check-signature.json.rb
b/www/secretary/workbench/views/actions/check-signature.json.rb
index 28b166e..5327e60 100644
--- a/www/secretary/workbench/views/actions/check-signature.json.rb
+++ b/www/secretary/workbench/views/actions/check-signature.json.rb
@@ -37,6 +37,10 @@ def getURI(uri,file)
f.puts segment
end
end
+ size = File.size(file)
+ if size > MAX_KEY_SIZE
+ raise Exception.new("File: #{file} size #{size} > #{MAX_KEY_SIZE}")
+ end
end
end
end
@@ -104,15 +108,11 @@ begin
getURI(uri, tmpfile)
size = File.size(tmpfile)
Wunderbar.warn "File: #{tmpfile} Size: #{size}"
- if size < MAX_KEY_SIZE # Don't import if it appears to be too big
- out2, err2, rc2 = Open3.capture3 gpg,
- '--batch', '--import', tmpfile
- # For later analysis
- Wunderbar.warn "#{gpg} --import #{tmpfile} rc2=#{rc2} out2=#{out2}
err2=#{err2}"
- found = true
- else
- Wunderbar.warn "File #{tmpfile} is too big: #{size}"
- end
+ out2, err2, rc2 = Open3.capture3 gpg,
+ '--batch', '--import', tmpfile
+ # For later analysis
+ Wunderbar.warn "#{gpg} --import #{tmpfile} rc2=#{rc2} out2=#{out2}
err2=#{err2}"
+ found = true
rescue Exception => e
Wunderbar.warn "GET uri=#{uri} e=#{e}"
err2 = e.to_s