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 eb7009f8 Simplify - Wunderbar handles parms etc for us
eb7009f8 is described below

commit eb7009f86082ba0ea7845d2122f213386574555c
Author: Sebb <[email protected]>
AuthorDate: Tue Apr 18 23:35:58 2023 +0100

    Simplify - Wunderbar handles parms etc for us
---
 www/secretary/upload_file.cgi | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/www/secretary/upload_file.cgi b/www/secretary/upload_file.cgi
index 213d9aa8..1bac1d66 100755
--- a/www/secretary/upload_file.cgi
+++ b/www/secretary/upload_file.cgi
@@ -21,7 +21,7 @@ _html do
     }
     ) do
       _whimsy_panel('Upload a new file to SVN', style: 'panel-success') do
-        _form.form_horizontal action: 'upload_file.cgi', method: 'post', 
enctype: "multipart/form-data" do
+        _form.form_horizontal method: 'post', enctype: "multipart/form-data" do
           _div.form_group do
             _label.control_label.col_sm_2 'SVN path', for: 'url'
             _div.col_sm_10 do
@@ -49,27 +49,24 @@ _html do
       end
       _div.well.well_lg do
         if _.post?
-          # params are arrays
-          url = params['url'].first
-          if url !~ %r{^https://(dist|svn)\.apache\.org/\S+$}
+          if @url !~ %r{^https://(dist|svn)\.apache\.org/\S+$}
               raise ArgumentError.new("Invalid SVN URL!")
           end
-          source = params['source'].first
-          msg = "Uploaded by Whimsy: #{params['msg'].first.strip}"
+          msg = "Uploaded by Whimsy: #{@msg}"
           # The source is StringIO for smaller files, Tempfile for larger ones
           # The cutoff seems to be somewhere between 18k and 27k
-          if source.instance_of? Tempfile
-            data = source
+          if @source.instance_of? Tempfile
+            data = @source
           else
-            data = source.read
+            data = @source.read
           end
-          name = source.original_filename.gsub(/[^-.\w]/, '_').sub(/^\.+/, '_')
+          name = @source.original_filename.gsub(/[^-.\w]/, '_').sub(/^\.+/, 
'_')
           ASF::Auth.decode(env = {})
           # data can either be a string or a Tempfile
-          if ASF::SVN.create_(url, name, data, msg, env, _) == 0
-            _p "Successfully added #{name} to #{url} !"
+          if ASF::SVN.create_(@url, name, data, msg, env, _) == 0
+            _p "Successfully added #{name} to #{@url} !"
           else
-            _p "File #{name} already exists at #{url} ?"
+            _p "File #{name} already exists at #{@url} ?"
           end
         end
       end

Reply via email to