Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] Fix crash when opening attachment with slashes in filename
@ 2010-07-30  3:09 Alvaro Herrera
  0 siblings, 0 replies; only message in thread
From: Alvaro Herrera @ 2010-07-30  3:09 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Hi,

This patch fixes a crash caused by trying to create a temp file with
forward slashes.  The fix is simple -- replace the slashes with a
different char.

I reported this as issue 105 on masanjin.net previously, but that's
apparently dead now.

--
Álvaro Herrera <alvherre@alvh.no-ip.org>

[-- Attachment #2: msgchunks.diff --]
[-- Type: application/octet-stream, Size: 748 bytes --]

From eb25896e484f59963ed7c5f543d00fad031d03d2 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 29 Jul 2010 22:59:20 -0400
Subject: [PATCH] Fix crash on handling attachment filename with slashes

---
 lib/sup/message-chunks.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index c275f41..be4416f 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -149,7 +149,7 @@ EOS
     end
 
     def write_to_disk
-      file = Tempfile.new(@filename || "sup-attachment")
+      file = Tempfile.new(@filename.gsub("/", "_") || "sup-attachment")
       file.print @raw_content
       file.close
       file.path
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-30  4:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30  3:09 [sup-devel] Fix crash when opening attachment with slashes in filename Alvaro Herrera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox