On Fri, 9 Jun 2000, Paul Gresham wrote:

> Excellent, thanks Bryan. I have another question? Do you have problems with
> browsers not obtaining the correct filenames of attachments when they are
> downloaded, i.e. the file becomes ATT0002.DAT or similar? I have this
> problem and also if I choose to download a file and then cancel the dialog,
> everything seems to get stuck, and I have to close the browser and start
> again.

Yeah, I have that same problem!  I'll have to take a look at it here soon.
I've attached another patch that you might find useful.  It appears that
WorldPilot barfs if the subject contains a quotation mark in it, but this
patch fixes it.  Also if you would like to try out the rpm and srpm I've
been working on for WorldPilot you can check them out here:

http://www.verinet.com/~arcane/worldpilot/worldpilot-1.0.4-6.noarch.rpm
http://www.verinet.com/~arcane/worldpilot/worldpilot-1.0.4-6.src.rpm

The only thing you'll have to change is the DOMAIN.py file.  Both of the
patches I've done so far have been included.  :)

Note: These are experimental RPMs, so you might want to not install them
on a mission critical server right away.  I personally haven't had any
problems, but you never know...  The only thing I'm worried about is what
happens if you try to install the rpm over a previous installation from a
tarball.  (Should work though)  You'll also have to restart Zope.

Bryan
--- WorldPilot.orig/WPUtil.py   Mon Jan 31 14:52:54 2000
+++ WorldPilot.mine/WPUtil.py   Fri Jun  9 16:04:41 2000
@@ -90,6 +90,7 @@
 import re

 import time

 import string

+import regsub
 try:

     import DateTime

 except: pass

@@ -101,7 +102,7 @@
       r'.*"')

 

 LiteralString = re.compile(r'\s*\{(?P<Size>\d+)\}(?P<Rest>.*)')

-QuotedString = re.compile(r'\s*"(?P<String>[^"]*)"(?P<Rest>.*)')

+QuotedString = re.compile(r'\s*"(?P<String>.*?[^\\](?="))"(?P<Rest>.*)')
 ListOpen = re.compile(r'\s*\((?P<Rest>.*)')

 ListClose = re.compile(r'\s*\)(?P<Rest>.*)')

 Atom = re.compile(r'\s*(?P<Atom>\\?[\w\[\]\.]+)(?P<Rest>.*)')

@@ -173,10 +174,14 @@
             conts=conts[1:]

             while line!="":

                 m=QuotedString.match(line)

-                if m:

-                    c.append(m.group('String'))

-                    line=m.group('Rest')

-                    continue

+                if m:
+                    # BS: IMAP returns quotes backslashed, so we must
+                    # remove the backslash here.
+                    cur_string = m.group('String')
+                    cur_string = regsub.gsub(r'\\"', '"', cur_string)
+                    c.append(cur_string)
+                    line=m.group('Rest')
+                    continue
                 m=ListOpen.match(line)

                 if m:

                     n=[]

Reply via email to