Refactor to refernce parts by sub-path

This commit is contained in:
Samuel Cochran 2011-10-07 22:15:59 +08:00
parent c3a3bb1880
commit 63432c27c8

View File

@ -67,7 +67,7 @@ module MailCatcher
body = part["body"]
# Rewrite body to link to embedded attachments served by cid
body.gsub! /cid:([^'"> ]+)/, "#{id}/\\1"
body.gsub! /cid:([^'"> ]+)/, "#{id}/parts/\\1"
# Rewrite body to open links in a new window
body.gsub! /<a\s+/, '<a target="_blank" '
@ -108,7 +108,7 @@ module MailCatcher
end
end
get "/messages/:id/:cid" do
get "/messages/:id/parts/:cid" do
id = params[:id].to_i
if part = MailCatcher::Mail.message_part_cid(id, params[:cid])
content_type part["type"], :charset => (part["charset"] || "utf8")