| Commit message (Collapse) | Author | Age |
| |
|
| |
|
|
|
|
| |
Forgotten during move in fe1450cba.
|
| |
|
|
|
|
|
|
| |
We should not try to guess anything, just use the platform encoding.
Remove helper.try_decode(), as it has no more callers.
|
|
|
|
|
|
|
| |
It does not actually save any code. The new code also uses a shell as is
documented.
Remove call_cmd(), as it no longer has any callers.
|
|
|
|
|
|
|
| |
It does not actually save any code. The new code also uses a shell as is
documented.
Remove call_cmd_async(), as it no longer has any callers.
|
|
|
|
|
|
|
|
|
|
|
| |
Add a class that encapsulates the handler and is responsible for
managing the temporary file, if one is needed.
Use this class for both rendering inline content and displaying
attachments externally.
External attachments are now wrapped in an asyncio task that is added to
a pool of tasks managed by ui.
|
|
|
|
|
|
|
|
| |
It just adds unnecessary type confusion.
In most places where it is used, the types are always str, so it does
nothing. In the few others, the encoding/decoding is better handled
explicitly.
|
| |
|
| |
|
| |
|
|
|
|
| |
Also, drop now-unnecessary call to decode_string
|
| |
|
|
|
|
|
|
|
| |
It has no relation to database, so helper seems like a better place for
it.
As there is nothing left in db/utils, it is removed.
|
| |
|
| |
|
|
|
|
| |
The local variable proc was not defined in these branches.
|
| |
|
|
|
|
|
|
|
|
| |
Depending on the libmagic/ctypes version, magic_version is a function or
a constant. So far, the code expected a constant and fails on the
function variant with a TypeError.
Test with callable() und use the magic_version attribute accordingly.
|
|
|
|
| |
to help troubleshoot problems
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3.3 added a new feature to the email module, policies
(https://docs.python.org/3.5/library/email.policy.html). Policy objects
allow precise control over how numerous features work when converting to
and from str or bytes. With the `email.policy.SMTP` the behavior of
email_as_bytes and email_as_string can be achieved using the builtin
`.as_string()` and `.as_bytes()` methods, without custom code or the
need to test it. Additionally these methods handle corner cases that we
don't currently handle, such as multi-part messages with different
encodings.
Fixes #1257
|
|
|
|
| |
that was solved upstream: https://bugs.python.org/issue14983
|
| |
|
|\
| |
| | |
Message from bytes
|
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 0b5f8bf143e76be7ac989e8c8ec6e4a7dc08a78a.
Chardet takes prohibitively long on large blobs (such as attachments).
It will be replaced by functions from the email module in subsequent
commits.
|
|/
|
|
| |
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
|
|
|
|
| |
They are not needed for python >= 3.0.
|
|
|
|
|
| |
This might be a little sloppy, but there are legitimate cases where
stdin is bytes, and cases where it is a string.
|
|
|
|
|
|
| |
The `assert` statement is not always executed (it can be optimised
away) so is not a suitable run-time check. Also, an exception allows
for a better error message.
|
| |
|
|
|
|
|
|
|
| |
magic struggles to decode a number of encodings, particularly it
struggles with windows-1252, which Exchange *loves* to silently
re-encode mail in, without updated the charset of the payload. Chardet
successfully guesses these oddball encodings much more often.
|
| |
|
|
|
|
|
| |
There are a few that are still broken because of bytes to unicode
conversion, and this may not all be correct, but most of the tests pass
|
| |
|
| |
|
| |
|
|
|
|
| |
shlex expectes unicode in python3
|
|
|
|
| |
This probably isn't completely right, but it's a start.
|
|
|
|
|
| |
cStringIO doesn't exist in python 3.x, instead one simply uses
io.StringIO and python provided a C accelerated version if possible.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use fallback, if an enviroment variable is unset *or* empty.
Bug:
- XDG_CONFIG_HOME='' alot
Problem:
Does not find the configuration file (among others), because
os.environ.get('XDG_CONFIG_HOME', '~/.config') returns '', instead of
'~/.config'.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
An assignment `e = os.environ` creates a reference not a copy, which
means that modifying one necessarily modifies the other. Using
`dict.copy` creates a shallow copy (the keys and values are references,
but the dicts are different objects), which means only modifications to
mutable objects are shared. In the case of os.environ which only
contains immutable objects like strings, bools, and numbers this isn't
an issue.
|
|
|
|
|
| |
Since the file is encoded in utf-8 we can actually print the ellipsis.
Most people can more readily read that than the raw utf-8 escape.
|
|
|
|
|
|
|
|
|
| |
This undoes a small subset of the changes from
fa3dd1b04567c4ea03fa658c3838b569531c79f5 and thus fixes #1132.
The io.BytesIO object was not able to handle the unicode header names
that where returned by envelope.construct_mail, which in turn did just
copy them from the envelope header.
|
|
|
|
|
|
|
|
| |
In python3 StringIO and cStringIO are gone. In their place are
io.BytesIO and io.StringIO. They are somewhat different in that they are
not separated on implementation, but on the type they emulated. BytesIO
works like the bytes class (str in python 2), while StringIO works like
the str class (unicode in python2).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The spec is very clear here:
(2) An appropriate Content-Transfer-Encoding is then applied; see
section 3. In particular, line endings in the encoded data
MUST use the canonical <CR><LF> sequence where appropriate
(note that the canonical line ending may or may not be present
on the last line of encoded data and MUST NOT be included in
the signature if absent).
That very last MUST NOT is what's important here, we shouldn't be adding
newlines if they weren't there to begin with. Because we do it causes
signed blobs that have newlines to be invalid since we've changed the
substance of the signed code.
|
| |
|