whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-276 Improve duplicate ICLA name checking
Date Tue, 16 Jul 2019 01:29:49 GMT
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 2cddfb8  WHIMSY-276 Improve duplicate ICLA name checking
2cddfb8 is described below

commit 2cddfb8887edad48d0d5ea163ed03cfb907d4a18
Author: Sebb <sebb@apache.org>
AuthorDate: Tue Jul 16 02:29:40 2019 +0100

    WHIMSY-276 Improve duplicate ICLA name checking
    
    ICLAs not considered duplicate if there's a file and a directory
    Only check for first error
    Warn if checks not even performed
---
 www/secretary/workbench/views/actions/icla.json.rb | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/www/secretary/workbench/views/actions/icla.json.rb b/www/secretary/workbench/views/actions/icla.json.rb
index c968dfe..7d8bb83 100644
--- a/www/secretary/workbench/views/actions/icla.json.rb
+++ b/www/secretary/workbench/views/actions/icla.json.rb
@@ -12,19 +12,23 @@ message = Mailbox.find(@message)
 
 @from.untaint if @from =~ /\A("?[\s\w]+"?\s+<)?\w+@apache\.org>?\z/
 
-# extract file extension
+# extract file extension (only needed if there is no signature)
 fileext = File.extname(@selected).downcase if @signature.empty?
 
 # verify that an ICLA under that name doesn't already exist
 if "#@filename#{fileext}" =~ /\w[-\w]*\.?\w*/
-  icladir = "#{ASF::SVN['iclas']}/#@filename" # also check for directory
+  icladir = "#{ASF::SVN['iclas']}/#@filename" # first check for directory
   if File.exist? icladir.untaint
     _warn "documents/iclas/#@filename already exists"
+  else
+    # now check for a file (may have various extensions)
+    file = Dir["#{icladir}.*"]
+    if file.any?
+      _warn "documents/iclas/#{File.basename(file.first)} already exists"
+    end
   end
-  icla = "#{ASF::SVN['iclas']}/#@filename#{fileext}"
-  if File.exist? icla.untaint
-    _warn "documents/iclas/#@filename#{fileext} already exists"
-  end
+else
+  _warn "#@filename#{fileext} does not appear to be a valid filename"
 end
 
 # extract/verify project


Mime
View raw message