You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/10/04 13:19:41 UTC
[whimsy] branch master updated: Fix up same safe_name
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 927c1f4 Fix up same safe_name
927c1f4 is described below
commit 927c1f4598557b44817ae682dcd20c78c40707fc
Author: Sebb <se...@apache.org>
AuthorDate: Sun Oct 4 14:19:33 2020 +0100
Fix up same safe_name
anchored gsub only applies once;
seems no point dropping only the first non-word char
what if there is more than one?
Use %r{} to remove ambiguity with division operator
---
www/secretary/workbench/models/attachment.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/www/secretary/workbench/models/attachment.rb b/www/secretary/workbench/models/attachment.rb
index 8ed35af..a1fdcb5 100644
--- a/www/secretary/workbench/models/attachment.rb
+++ b/www/secretary/workbench/models/attachment.rb
@@ -39,8 +39,7 @@ class Attachment
def safe_name
name = self.name.dup
- name.gsub! /^\W/, ''
- name.gsub! /[^\w.]/, '_'
+ name.gsub! %r{[^\w.]}, '_'
name
end