| Commit message (Collapse) | Author | Age | Lines |
| |\ |
|
| | |
| |
| |
| |
| |
| | |
Main intent here is to be more explicit about what form you're
getting the attachment body in - valid UTF-8 or binary, and has it
been cleaned up in order to be UTF-8?
|
| | |
| |
| |
| | |
Also be explicit about using UTF-8 when handling text data.
|
| | |
| |
| |
| |
| | |
Don't call the method unless we need to. Adds #set_api_key! to set a new
API key even if there's an existing one.
|
| |/
|
|
|
|
| |
Add spec to demonstrate that admin-added bodies aren't getting derived attributes.
Add a spec to demonstrate the problem setting the first letter for translations.
Demonstrate failure to update derived attributes in translations.
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Just check if there's an associated InfoRequest.
user system total real
old 0.010000 0.000000 0.010000 ( 0.012269)
new 0.000000 0.000000 0.000000 ( 0.000101)
|
| |\ \
| |/
|/| |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ruby can natively decode uuencoded text with String#unpack. [1] This
avoids the uuencode program dependency and avoids writing tempfiles.
The actual implementation is taken from mail [2]. The UnixToUnix module
is not available in our bundled version of mail.
This commit includes a spec to illustrate the failure of uuencode(1) to
decode the particular attachment in incoming-request-bad-uuencoding-2.
email. Parsing with uuencode returns the following error:
External Command: Error from command "uudecode -o /dev/stdout
/tmp/foiuu20150530-14811-u6j936":
uudecode: /tmp/foiuu20150530-14811-u6j936: No `end' line
The file _is_ created and appears to be OK, but the exit code is 1. This
causes AlaveteliExternalCommand to fail and return nil.
See #2508 [3] for the bug report.
[1] http://ruby-doc.org/core-1.8.7/String.html#method-i-unpack
[2] https://github.com/mikel/mail/blob/bc4c9bb9321e9d36a678692f2f562d3146b63f78/lib/mail/encodings/unix_to_unix.rb#L7
[3] https://github.com/mysociety/alaveteli/issues/2508
|
| | |
| |
| | |
Inspired by https://github.com/mikel/mail/commit/bc4c9bb9321e9d36a678692f2f562d3146b63f78
|
| |\| |
|
| | |\ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I think I was wrong in a83b379fd2d676172855825d0592937b234371e2 in
assuming that all email gets properly encoded for transfer. Looking
at the mail gem load method
https://github.com/mikel/mail/blob/b159e0a542962fdd5e292a48cfffa560d7cf412e/lib/mail/mail.rb#L175a,
it reads raw email content from a file in binary mode. So this commit
makes both reading and writing the raw_email a binary mode operation
and adds a data_as_text method for displaying the data in the admin
interface that coerces it to valid utf-8.
|
| | | |
| | |
| | |
| | | |
Move setup to spec - not in common with other specs.
|
| | | |
| | |
| | |
| | |
| | | |
We don't write the data for a raw email to the database anymore.
It's written to a file.
|
| | | | |
|
| | |/ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
mb_chars provides a multibyte-aware wrapper for strings. It should
have no effect on ruby 1.9.3 and above. Although ruby 1.8.7 wouldn't
raise errors on a badly sliced multibyte string, on upgrading to ruby
1.9.3 and above, string operations such as gsub, match and join may
produce ArgumentErrors with the message "invalid byte sequence in UTF-8".
Additionally, a database with 'UTF-8' encoding may produce the error
"PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8""
|
| |\ \
| | |
| | |
| | | |
rails-3-develop
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
Cleaned up by @jpmckinney in 4329ffa27cf83c00e03a0b0600ee54ce06056ee3,
so adding a couple of regression specs.
|
| |/ /
| |
| |
| |
| |
| | |
Don't call load_raw_emails for all specs - only needed for one.
Don't call update_display_size! explicitly - the point of the
test is that body= should set it as a side effect.
|
| |\ \ |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
This is important under ruby 1.9 in order to determine the
encoding that will be used for new strings created in the code in
the file.
|
| |\ \ \ |
|
| | | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
mb_chars provides a multibyte-aware wrapper for strings. It should
have no effect on ruby 1.9.3 and above. Although ruby 1.8.7 wouldn't
raise errors on a badly sliced multibyte string, on upgrading to ruby
1.9.3 and above, string operations such as gsub, match and join may
produce ArgumentErrors with the message "invalid byte sequence in UTF-8".
Additionally, a database with 'UTF-8' encoding may produce the error
"PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8""
|
| |\ \ \ |
|
| | | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
user system total real
old 1.070000 0.280000 1.350000 ( 1.657773)
new 0.560000 0.120000 0.680000 ( 0.743485)
|
| |\ \ \ \
| |_|_|/
|/| | | |
|
| | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If we’re in the context of an InfoRequest and want the
OutgoingMessage#body, we can pass the rules in explicitly to avoid
looking up the info request again. Otherwise it falls back to the
existing behaviour.
|
| | | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Still need to `return nil if text_to_censor.nil?` because `gsub!`
returns `nil` rather than the original text if it does not make a
substitution.
|
| | |/ / |
|
| |/ / |
|
| |\ \ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a workaround for an issue where YAML in ruby 1.8 tags UTF-8
heavy strings as binary, resulting in them being retrieved under 1.9
as ASCII-8BIT which can't be concatenated with UTF-8.
Described as "Deep deep YAML oddness" in
https://www.zendesk.com/blog/upgrade-the-road-to-1-9/.
|
| | | |
| | |
| | |
| | |
| | | |
Doesn't need to try to set the default law_used once it's persisted,
so we save a query each time we find an InfoRequest
|
| |/ / |
|
| |\| |
|
| | |
| |
| |
| |
| | |
If you run an Alaveteli in a region where we can’t show holiday
suggestions the holiday import page breaks. This commit rescues from
an unavailable region so that we display a friendly error message.
|
| | |
| |
| |
| |
| |
| | |
Next commit adds a new spec; this before block was affecting the
behaviour of the new spec.
https://robots.thoughtbot.com/lets-not
|
| |\ \ |
|
| | | | |
|
| | | | |
|
| | | | |
|
| |/ / |
|
| | |
| |
| |
| |
| | |
This is so if you're overriding the request email you can still
observe how Alaveteli behaves when there's no request email set.
|
| | | |
|
| |\ \ |
|
| | |/ |
|