@@ -153,7 +153,11 namespace :redmine do | |||
|
153 | 153 | private |
|
154 | 154 | def trac_fullpath |
|
155 | 155 | attachment_type = read_attribute(:type) |
|
156 | trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) {|x| sprintf('%%%02x', x[0]) } | |
|
156 | #replace exotic characters with their hex representation to avoid invalid filenames | |
|
157 | trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) do |x| | |
|
158 | codepoint = RUBY_VERSION < '1.9' ? x[0] : x.codepoints.to_a[0] | |
|
159 | sprintf('%%%02x', codepoint) | |
|
160 | end | |
|
157 | 161 | "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{id}/#{trac_file}" |
|
158 | 162 | end |
|
159 | 163 | end |
General Comments 0
You need to be logged in to leave comments.
Login now