You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/09/21 13:24:46 UTC

[whimsy] branch master updated: warn if file already exists

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  b863bc4   warn if file already exists
b863bc4 is described below

commit b863bc4adbcf9fa9cb03d903df847489448c6446
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 21 09:24:31 2016 -0400

    warn if file already exists
---
 www/secmail/views/actions/ccla.json.rb  | 8 ++++++++
 www/secmail/views/actions/grant.json.rb | 8 ++++++++
 www/secmail/views/actions/icla.json.rb  | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/www/secmail/views/actions/ccla.json.rb b/www/secmail/views/actions/ccla.json.rb
index 32c2bf4..2206e1f 100644
--- a/www/secmail/views/actions/ccla.json.rb
+++ b/www/secmail/views/actions/ccla.json.rb
@@ -11,6 +11,14 @@ message = Mailbox.find(@message)
 # extract file extension
 fileext = File.extname(@selected) if @signature.empty?
 
+# verify that a CCLA under that name doesn't already exist
+if "#@filename#{fileext}" =~ /\w[-\w]*\.?\w*/
+  ccla = "#{ASF::SVN['private/documents/cclas']}/#@filename#{fileext}"
+  if File.exist? ccla.untaint
+    _warn "documents/cclas/#@filename#{fileext} already exists"
+  end
+end
+
 # extract/verify project
 if @project and not @project.empty?
   pmc = ASF::Committee[@project]
diff --git a/www/secmail/views/actions/grant.json.rb b/www/secmail/views/actions/grant.json.rb
index d12493d..2adbfb8 100644
--- a/www/secmail/views/actions/grant.json.rb
+++ b/www/secmail/views/actions/grant.json.rb
@@ -11,6 +11,14 @@ message = Mailbox.find(@message)
 # extract file extension
 fileext = File.extname(@selected) if @signature.empty?
 
+# verify that a grant under that name doesn't already exist
+if "#@filename#{fileext}" =~ /\w[-\w]*\.?\w*/
+  grant = "#{ASF::SVN['private/documents/grants']}/#@filename#{fileext}"
+  if File.exist? grant.untaint
+    _warn "documents/grants/#@filename#{fileext} already exists"
+  end
+end
+
 # extract/verify project
 if @project and not @project.empty?
   pmc = ASF::Committee[@project]
diff --git a/www/secmail/views/actions/icla.json.rb b/www/secmail/views/actions/icla.json.rb
index bbb8472..6881234 100644
--- a/www/secmail/views/actions/icla.json.rb
+++ b/www/secmail/views/actions/icla.json.rb
@@ -13,6 +13,14 @@ message = Mailbox.find(@message)
 # extract file extension
 fileext = File.extname(@selected) if @signature.empty?
 
+# verify that an ICLA under that name doesn't already exist
+if "#@filename#{fileext}" =~ /\w[-\w]*\.?\w*/
+  icla = "#{ASF::SVN['private/documents/iclas']}/#@filename#{fileext}"
+  if File.exist? icla.untaint
+    _warn "documents/iclas/#@filename#{fileext} already exists"
+  end
+end
+
 # extract/verify project
 if @project and not @project.empty?
   pmc = ASF::Committee[@project]

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].