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 2020/10/24 23:51:42 UTC

[whimsy] branch master updated: safety checks

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

rubys 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 de9b1a7  safety checks
de9b1a7 is described below

commit de9b1a7151583358e82ced99154665c2200fb261
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Oct 24 19:51:08 2020 -0400

    safety checks
---
 www/board/agenda/daemon/session.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/daemon/session.rb b/www/board/agenda/daemon/session.rb
index c415c4a..216e57d 100644
--- a/www/board/agenda/daemon/session.rb
+++ b/www/board/agenda/daemon/session.rb
@@ -87,9 +87,13 @@ class Session
         secret = File.basename(file)
         session = @@sessions[secret]
 
-        if File.exist? file
+        if File.exist?(file) and File.writable?(file)
           if File.mtime(file) < Time.now - 2 * DAY
-            File.delete file
+            begin
+              File.delete file
+            rescue RuntimeError => error
+              STDERR.puts "Error deleting #{file}: #{error}"
+            end
           else
             # update class variables if the file changed
             mtime = File.mtime(file)