Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #281 - added backslashing of special characters #367

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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