2009年7月6日月曜日

Trac から Redmine の移行で日本語添付ファイルが移行できない時

${REDMINE_HOME}/lib/tasks/migrate_from_trac.rakeを以下のように修正する。
なんでこんな問題放置されてるんだ?日本語環境だけなのかな。
TracLightningからの移行で確認しました。

private
def trac_fullpath
attachment_type = read_attribute(:type)
- trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) {x sprintf('%%%02x', x[0]) }
- "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{id}/#{trac_file}"
+ "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{URI.escape(id)}/#{URI.escape(filename)}"
end
end

0 件のコメント: