Re: Attaching messages with 2004/10/11 snapshot

George Ross <[email protected]>
Newsgroups gmane.mail.exmh.devel
Message-ID <[email protected]>
> > I presume '/' was dropped to protect the other case where FSBox is passed a 
> > default, viz saving a MIME part.  Perhaps it needs to have some way to 
> > distinguish the two cases?
> 
> Yes, '/' was intentionally excluded for the saving-a-MIME-part case.
> I hadn't noticed a problem when attaching a regular file, but failed to
> consider the attach-a-message case.
> 
> The proper fix would be to pass a flag, and only do the smashing when
> *saving* a MIME part - there's no exposure if the user is selecting an
> already-existing file to attach to outbound mail, as the problem is
> for inbound mail only...

How about the following (diffs against Brent's recent 2.7.2)?  The default 
is to smash the filename, as before, with only a handful of cases flagged 
explicitly as safe.

--- lib/fileselect.tcl.dist	2005-01-05 13:51:13.000000000 +0000
+++ lib/fileselect.tcl	2005-01-05 13:57:54.000000000 +0000
@@ -60,14 +60,16 @@
     }
 }
 
-proc FSBox {{purpose "Select file:"} {defaultName ""} {cmd ""} {errorHandler ""}} {
+proc FSBox {{purpose "Select file:"} {defaultName ""} {cmd ""} {errorHandler ""} {smash 1}} {
     global fileselect
     global exwin
 
-    # Smash out anything that isn't alphanumeric, period, underscore or dash
-    regsub -all {[^[:print:]._-]+} $defaultName _ defaultName
-    # Oh, and too many things treat dot-files as special...
-    regsub {^\.+} $defaultName _ defaultName
+    if {$smash} {
+        # Smash out anything that isn't alphanumeric, period, underscore or dash
+        regsub -all {[^[:print:]._-]+} $defaultName _ defaultName
+        # Oh, and too many things treat dot-files as special...
+        regsub {^\.+} $defaultName _ defaultName
+    }
 
 	set fileselect(origname) $defaultName
     if $fileselect(dotsByDefault) {
--- lib/seditExtras.tcl.dist	2005-01-05 13:55:43.000000000 +0000
+++ lib/seditExtras.tcl	2005-01-05 14:22:26.000000000 +0000
@@ -431,7 +431,7 @@
 
 proc SeditInsertFileDirect { draft t } {
     global sedit
-    set name [FSBox "Select file name"]
+    set name [FSBox "Select file name" "" "" "" 0]
     if {$name != ""} {
 	if [file readable $name] {
 	    # check for 8bit characters in the file
@@ -450,7 +450,7 @@
 }
 proc SeditInsertFileDialog { draft t } {
     global sedit
-    set name [FSBox "Select file name"]
+    set name [FSBox "Select file name" "" "" "" 0]
     if {$name != ""} {
 	if [file readable $name] {
 	    set options [SeditFormatDialog $t $name]
@@ -499,7 +499,7 @@
 	set name {}
 	set options [SeditExternalUrlDialog $t $name]
     } else {
-        set name [FSBox "(Optionally) Select file name"]
+        set name [FSBox "(Optionally) Select file name" "" "" "" 0]
         set options [SeditExternalFileDialog $t $name]
         }
     set tmpfname [Mime_TempFile extern]
@@ -1074,7 +1074,7 @@
 
 proc SeditInsertMessageDialog { draft t } {
     global sedit msg
-    set name [FSBox "Select message" $msg(path)]
+    set name [FSBox "Select message" $msg(path) "" "" 0]
     if {$name != ""} {
 	if [file readable $name] {
 	    set options [SeditFormatDialog $t $name]

-- 
Dr George D M Ross, School of Informatics, University of Edinburgh
    Kings Buildings, Mayfield Road, Edinburgh, Scotland, EH9 3JZ
Mail: [email protected]   Voice: +44 131 650 5147   Fax: +44 131 667 7209
 PGP: 1024D/AD758CC5  B91E D430 1E0D 5883 EF6A  426C B676 5C2B AD75 8CC5

_______________________________________________
Exmh-workers mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/exmh-workers
signature.asc (application/pgp-signature, 229 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.92 (GNU/Linux)
Comment: Exmh version 2.6.3 2003/04/04

iD8DBQFB3AF8tnZcK611jMURAl2JAJ9iuU3+iNkv9c8i6TEvAHYzBPSdKwCfW2LQ
CS2PmRcoks+STumRY3yoZu4=
=Winj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.