Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/sup/modes/edit_message_mode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,20 @@ def unsaved?; edited? end
def attach_file
fn = BufferManager.ask_for_filename :attachment, "File name (enter for browser): "
return unless fn

if HookManager.enabled? "check-attachment"
reason = HookManager.run("check-attachment", :filename => fn)
if reason
return unless BufferManager.ask_yes_or_no("#{reason} Attach anyway?")
end
end
begin
# This code is being used to backslash special characters in file name
fn.gsub! "\\", "\\\\\\\\"
fn.gsub! '*', '\*'
fn.gsub! '?', '\?'
fn.gsub! "[", "\\["
# End of this code
Dir[fn].each do |f|
@attachments << RMail::Message.make_file_attachment(f)
@attachment_names << f
Expand All @@ -375,7 +382,7 @@ def rerun_crypto_selector_hook
HookManager.run "crypto-mode", :header => @header, :body => @body, :crypto_selector => @crypto_selector
end
end

def mime_encode string
string = [string].pack('M') # basic quoted-printable
string.gsub!(/=\n/,'') # .. remove trailing newline
Expand Down