You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cl...@apache.org on 2020/07/09 21:30:43 UTC

[whimsy] 01/02: Update file handling for emeritus request

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

clr pushed a commit to branch roster-emeritus
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit 2cbabb3e495c0720ae923da24a8606b34231eb4a
Author: Craig L Russell <ap...@gmail.com>
AuthorDate: Thu Jul 9 14:26:36 2020 -0700

    Update file handling for emeritus request
---
 lib/whimsy/asf/svn.rb                    |  2 +-
 www/roster/views/actions/memstat.json.rb | 29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 13e2211..c979e77 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -753,7 +753,7 @@ module ASF
       out, err = self.svn('list', target, {env: env})
       return 1 if out # already exists
       # Need to check for unexpected errors; the error message does not include the full repo URL
-      unless err =~ %r{^svn: warning: W160013: Path '.+#{filename}' not found}
+      unless err =~ %r{^svn: warning: W160013:}
         throw RuntimeError.new("#{filename} already exists! #{err}")
       end
       commands = [['put', source, target]]
diff --git a/www/roster/views/actions/memstat.json.rb b/www/roster/views/actions/memstat.json.rb
index b13f217..0e51c9f 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -77,23 +77,26 @@ elsif @action == 'request_emeritus'
     .gsub('Signed: __________________________________________________________',
           'Signed by validated user at: ________Whimsy www/committer_________')
     .gsub('Date: _________________________________',
-          ('Date: _______' + centered_date))
+          ('Date: _______' + centered_date)).untaint
   # Write the emeritus request to emeritus-requests-received
   EMERITUS_REQUEST_URL = ASF::SVN.svnpath!('emeritus-requests-received').untaint
-  rc = ASF::SVN.create_(EMERITUS_REQUEST_URL, "#{USERID}.txt", signed_request, "Emeritus request from #{USERNAME}  (#{USERID}", env, _)
-  ASF::Mail.configure
-  mail = Mail.new do
-    from "secretary@apache.org"
-    to "#{USERNAME}<#{USERMAIL}>"
-    subject "Emeritus request acknowledgement from #{USERNAME}"
-    text_part do
-      body "This acknowledges receipt of your emeritus request. You can find the request at #{EMERITUS_REQUEST_URL}/#{USERID}.txt. A copy is attached for your records.\n\nRegards,\n\nsecretary@apache.org\n\n"
+  Dir.mktmpdir do |tmpdir|
+    filename =File.join(tmpdir,'tmpfile')
+    File.write(filename, signed_request)
+    if 0 == ASF::SVN.create_(EMERITUS_REQUEST_URL, "#{USERID}.txt", filename, "Emeritus request from #{USERNAME} (#{USERID})", env, _)
+      ASF::Mail.configure
+      mail = Mail.new do
+        from "secretary@apache.org"
+        to "#{USERNAME}<#{USERMAIL}>"
+        subject "Emeritus request acknowledgement from #{USERNAME}"
+        text_part do
+          body "This acknowledges receipt of your emeritus request. You can find the request at #{EMERITUS_REQUEST_URL}/#{USERID}.txt. A copy is attached for your records.\n\nWarm Regards,\n\nSecretary, Apache Software Foundation\nsecretary@apache.org\n\n"
+        end
+      end
+      mail.attachments["#{USERID}.txt"] = signed_request
+      mail.deliver!
     end
   end
-  mail.attachments["#{USERID}.txt"] = signed_request.untaint
-  if rc == 0
-    mail.deliver!
-  end
 elsif @action == 'request_reinstatement'
   ASF::Mail.configure
   mail = Mail.new do