diff options
author | Go MAEDA <maeda@farend.jp> | 2024-08-21 00:46:15 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-08-21 00:46:15 +0000 |
commit | 93645a279e68b5f23d13c340d96ede3f65aff635 (patch) | |
tree | 99c47c51197d9b285fe4b05d073fd55208df54e5 /app/models/attachment.rb | |
parent | c069ea3a2440f4cb0641abd4e3ddb6be5bd6bdb2 (diff) | |
download | redmine-93645a279e68b5f23d13c340d96ede3f65aff635.tar.gz redmine-93645a279e68b5f23d13c340d96ede3f65aff635.zip |
Use anonymous block forwarding introduced in Ruby 3.1 (#38585).
git-svn-id: https://svn.redmine.org/redmine/trunk@22973 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r-- | app/models/attachment.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 7fc8a8ab0..dea287c97 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -553,7 +553,7 @@ class Attachment < ApplicationRecord # Singleton class method is public class << self # Claims a unique ASCII or hashed filename, yields the open file handle - def create_diskfile(filename, directory=nil, &block) + def create_diskfile(filename, directory=nil, &) timestamp = DateTime.now.strftime("%y%m%d%H%M%S") ascii = '' if %r{^[a-zA-Z0-9_\.\-]*$}.match?(filename) && filename.length <= 50 @@ -572,7 +572,7 @@ class Attachment < ApplicationRecord File.join(path, name), flags: File::CREAT | File::EXCL | File::WRONLY, binmode: true, - &block + & ) rescue Errno::EEXIST timestamp.succ! |