]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
special case encode / as ~
authorDavid Bremner <bremner@unb.ca>
Tue, 1 Jul 2008 12:23:29 +0000 (14:23 +0200)
committerDavid Bremner <bremner@unb.ca>
Tue, 1 Jul 2008 12:23:29 +0000 (14:23 +0200)
Convert/YText.pm
filters/expand-iki-address.pl
filters/test1.eml

index 0ce9b48f13a6cd4b9dc76c299d31a8356b1887d8..e8ea42abef20f1fe16d26d33d42d37bf10e567f5 100644 (file)
@@ -41,10 +41,10 @@ local part of an address: "!#$%&'*+-/=?^_`{|}~". On the other hand, it
 seems common in practice to block addresses having "%!/|`#&?" in the
 local part.  The idea is to restrict ourselves to basic ASCII
 alphanumerics, plus a small set of printable ASCII, namely "=_+-~.".
-Spaces are replaced with "_", the characters "A-Za-z0-9.\+\-~" encode
-as themselves, and everything else is written "=USTR=" where USTR is
-the base64 (using "A-Za-z0-9\+\-\." as digits) encoding of the unicode
-character code.
+Spaces are replaced with "_", "/" with "~", the characters
+"A-Za-z0-9.\+\-~" encode as themselves, and everything else is written
+"=USTR=" where USTR is the base64 (using "A-Za-z0-9\+\-\." as digits)
+encoding of the unicode character code.
 
 The characters '+' and '-' are pretty widely used to attach suffixes
 (although usually only one works on a given mail host). It seems ok to
@@ -94,9 +94,11 @@ sub decode_str($){
 sub encode_ytext($){
     my $str=shift;
     # "=" we use as an escape, and '_' for space
-    $str=~ s/([^a-zA-Z0-9+\-~. ])/"=".encode_num(ord($1))."="/ge;
+    $str=~ s/([^a-zA-Z0-9+\-\/. ])/"=".encode_num(ord($1))."="/ge;
+    
+    $str=~ s|/|~|g;
     $str=~ s/ /_/g;
-
+    
     return $str;
 };
 
@@ -104,7 +106,7 @@ sub decode_ytext($){
     my $str = shift;
     $str=~ s/=([a-zA-Z0-9+\-\.])+=/ decode_str($1)/eg;
     $str=~ s/_/ /g;
-
+    $str=~ s|~|/|g;
     return $str;
 }
 
index 734a50e37f6eb9f0c8dc7307e280dcfa54d1b26d..289aaf61571c4f2677e63771df8f9116cf8c1aed 100644 (file)
@@ -8,7 +8,7 @@ my $mail = Mail::Internet->new([<>]);
 
 my $to = $mail->get('To:');
 
-if ($to =~ m/$prefix([A-Za-z0-9\.\+\=\-_]+)\@/){
+if ($to =~ m/$prefix([A-Za-z0-9\.\+\=\-_\~]+)\@/){
     my $key=$1;
     my $page=decode_ytext($key);
     $mail->replace('X-IkiWiki-Page:',$page);
index ee0c87ec8fcf7621c40aa708a8c724b89c622fa6..5b1be278ec38f3dd02b8a1e8644259baffaec083 100644 (file)
@@ -1,29 +1,29 @@
-From bremner@unb.ca Tue Jul 01 08:47:05 2008
+From bremner@unb.ca Tue Jul 01 09:22:23 2008
 Return-path: <bremner@unb.ca>
-Envelope-to: bremner-comment-blog=v=posts=v=user_level_NetworkManager_dispatcher@pivot.cs.unb.ca
-Delivery-date: Tue, 01 Jul 2008 08:47:05 -0300
+Envelope-to: bremner-comment-blog~posts~filling_in_forms_with_pdftk@pivot.cs.unb.ca
+Delivery-date: Tue, 01 Jul 2008 09:22:23 -0300
 Received: from [141.44.229.26] (helo=rocinante.cs.unb.ca)
        by pivot.cs.unb.ca with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
        (Exim 4.69)
        (envelope-from <bremner@unb.ca>)
-       id 1KDeK9-0006DB-7Y
-       for bremner-comment-blog=v=posts=v=user_level_NetworkManager_dispatcher@pivot.cs.unb.ca; Tue, 01 Jul 2008 08:47:05 -0300
+       id 1KDesI-0006HF-VQ
+       for bremner-comment-blog~posts~filling_in_forms_with_pdftk@pivot.cs.unb.ca; Tue, 01 Jul 2008 09:22:23 -0300
 Received: from bremner by rocinante.cs.unb.ca with local (Exim 4.69)
        (envelope-from <bremner@unb.ca>)
-       id 1KDeJF-0007AA-Hp
-       for bremner-comment-blog=v=posts=v=user_level_NetworkManager_dispatcher@pivot.cs.unb.ca; Tue, 01 Jul 2008 13:46:09 +0200
+       id 1KDerP-0008FX-CM
+       for bremner-comment-blog~posts~filling_in_forms_with_pdftk@pivot.cs.unb.ca; Tue, 01 Jul 2008 14:21:27 +0200
 From: David Bremner <bremner@unb.ca>
 Organization: University of New Brunswick, Alpha Centurai Campus
-To: bremner-comment-blog=v=posts=v=user_level_NetworkManager_dispatcher@pivot.cs.unb.ca
-Subject: this is a test of the postal plugin
-Date: Tue, 1 Jul 2008 13:46:09 +0200
+To: bremner-comment-blog~posts~filling_in_forms_with_pdftk@pivot.cs.unb.ca
+Subject: this is a test of special casing for /
+Date: Tue, 1 Jul 2008 14:21:27 +0200
 User-Agent: KMail/1.9.9
 MIME-Version: 1.0
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
-Message-Id: <200807011346.09526.bremner@unb.ca>
+Message-Id: <200807011421.27352.bremner@unb.ca>
 X-Host-Lookup-Failed: Reverse DNS lookup failed for 141.44.229.26 (failed)
 X-Sender-Verified: bremner@unb.ca