Comments (6)
Original comment by Menno Smits (Bitbucket: mjs0):
Fixed in r142.
Thanks
from imapclient.
Original comment by Menno Smits (Bitbucket: mjs0):
Thanks, I'll try and get this sorted before the 0.6 release goes out.
from imapclient.
Original comment by Mark Eichin (Bitbucket: eichin):
Working with trunk (r139), it looks like it again does the wrong thing with a gmail folder name that begins with quotes (as opposed to merely containing them); a folder named
"Make" Magazine (ORA)
becomes
Make" Magazine (ORA
Turning off this bit of re-unquoting from r103 fixes my case, but I don't know if it impacts non-gmail IMAP servers...
diff -r be5626eee037 imapclient/response_parser.py
--- a/imapclient/response_parser.py Wed Mar 17 02:10:37 2010 +0000
+++ b/imapclient/response_parser.py Wed Mar 17 02:13:56 2010 -0400
@@ -207,8 +207,8 @@
raise ParseError('Expecting literal of size %d, got %d' % (
literal_len, len(literal_text)))
return literal_text
- elif token.startswith('"'):
-
return token[1:-1]
- #elif token.startswith('"'):
-
return token[1:-1]
elif token.isdigit():
return int(token)
else:
from imapclient.
Original comment by Menno Smits (Bitbucket: mjs0):
Fixed in r91 thru r95
from imapclient.
Original comment by Mark Eichin (Bitbucket: eichin):
Replying to [comment:2 mjs0]:
Possible workaround (with debugging still in)...
- use a named backref
qqq
inre_folder
, so that we can use a greedy match on the foldername regardless of whether or not it has quotes (ie. if and only if there's a start quote, match an end one) - use a named ref for the folder name itself
- clean up the extra quoting (in
list_folders
, thoughlist_sub_folders
needs both 2 and 3 as well)
With these changes, all of my gmail foldernames round-trip from list_folders
back to select_folder
, except for [Gmail]
itself; I haven't tested this against any other implementation. extract_folder_from_line
probably needs to be a common function called by list_folders
and list_sub_folders
anyway, instead of a shared regexp.
diff -r 5ac3ccadb5fc imapclient/imapclient.py
--- a/imapclient/imapclient.py Fri Dec 18 17:17:30 2009 +0000
+++ b/imapclient/imapclient.py Sun Dec 27 01:50:30 2009 -0500
@@ -63,7 +63,7 @@
ReadOnlyError = imaplib.IMAP4.readonly
re_sep = re.compile('^\(\("[^"]*" "([^"]+)"\)\)')
- re_folder = re.compile('\([^)]*\) "[^"]+" "?([^"]+)"?')
+ re_folder = re.compile(r'\([^)]*\) "[^"]+" (?P<qqq>"?)(?P<folder>.+)(?P=qqq)')
re_status = re.compile(r'^\s*"?(?P<folder>[^"]+)"?\s+'
r'\((?P<status_items>.*)\)$')
@@ -169,7 +169,10 @@
else:
match = self.re_folder.match(line)
if match:
- folder_text = match.group(1)
+ folder_text = match.group("folder")
+ print "matched folder", repr(folder_text), "in", repr(line)
+ folder_text = folder_text.replace('\\"', '"')
+ print " fixed folder", repr(folder_text)
if folder_text is not None:
folders.append(self._decode_folder_name(folder_text))
return folders
from imapclient.
Original comment by Menno Smits (Bitbucket: mjs0):
This problem doesn't occur with all IMAP servers. Gmail uses backslash escaping so the problem occurs there. Dovecot returns folders with double quotes in a literal which doesn't trip IMAPClient up.
Example Gmail response:
* LIST (\HasNoChildren) "/" "Test \"folder\""
The new response parser should handle this cleanly. It should be possible to use a temporary fix in the mean time.
from imapclient.
Related Issues (20)
- More meaningful `license` field in setup.py?
- IMAP4_TLS.open() error HOT 4
- How print the raw imap messege sent?
- How to preserve the unread status? HOT 3
- Replace deprecated imp module with importlib HOT 1
- Consider dropping support for End-of-Life Python 3.6 HOT 2
- Special folder attributes, even when SPECIAL-USE is not defined HOT 2
- idle_check can see incomplete lines HOT 8
- "%" symbol in password
- SELECT Unsafe Login HOT 1
- search搜索失败 HOT 3
- Modernize build process
- Build releases and send to PyPI using GitHub Actions
- subject search chinese not support? HOT 3
- Files missing in tests folders HOT 2
- KeyError: b'RFC822' HOT 1
- idle_check seems to run into a dead loop without any exceptions HOT 1
- SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256-PLUS + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports
- RFC 9266: Channel Bindings for TLS 1.3 support
- IMAPClient doesn't create a default SSL context for SSL connections HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imapclient.