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 95127c1  cl can be nil; allow for bigger key
95127c1 is described below

commit 95127c1b06a6a89064cb64dd875a5b9f5840a827
Author: Sebb <[email protected]>
AuthorDate: Fri Apr 1 15:25:43 2022 +0100

    cl can be nil; allow for bigger key
    
    Larger key: F2877BBA141AAD7F, size 44973
---
 .../workbench/views/actions/check-signature.json.rb      | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/www/secretary/workbench/views/actions/check-signature.json.rb 
b/www/secretary/workbench/views/actions/check-signature.json.rb
index 53c3ae5..d9a6a0d 100644
--- a/www/secretary/workbench/views/actions/check-signature.json.rb
+++ b/www/secretary/workbench/views/actions/check-signature.json.rb
@@ -32,7 +32,7 @@ def getServerURI(server, keyid)
   return uri
 end
 
-MAX_KEY_SIZE = 22000 # don't import if the ascii keyfile is larger than this
+MAX_KEY_SIZE = 45000 # don't import if the ascii keyfile is larger than this
 
 require 'net/http'
 
@@ -47,14 +47,18 @@ def getURI(uri, file)
         raise Exception.new("Get #{uri} failed with #{res.code}: 
#{res.message}")
       end
       cl = res.content_length
-      Wunderbar.warn "Content-Length: #{cl}"
-      if cl > MAX_KEY_SIZE # fail early
-        raise Exception.new("Content-Length: #{cl} > #{MAX_KEY_SIZE}")
+      if cl
+        Wunderbar.warn "Content-Length: #{cl}"
+        if cl > MAX_KEY_SIZE # fail early
+          raise Exception.new("Content-Length: #{cl} > #{MAX_KEY_SIZE}")
+        end
+      else
+        Wunderbar.warn "Content-Length not provided, continuing"
       end
-      File.open(file,"w") do |f|
+      File.open(file, "w") do |f|
         # Save the data directly; don't store in memory
         res.read_body do |segment|
-            f.puts segment
+          f.puts segment
         end
       end
       size = File.size(file)

Reply via email to