| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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""
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Fixes submission of form containing both existing and new
translations
|
| |
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
app/views/public_body/show.html.erb
|
| | |
|
| |
| |
| |
| |
| | |
There's only one call to this function in the rest of the code. That
has 'html' set to true.
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
- Redefined User#public_banned? to User#banned?
- Add specs for User#banned?
- Deprecate User#public_banned?
- Replace use of User#public_banned? with User#banned?
|
|\ |
|
| |
| |
| |
| |
| | |
Existing behaviour seems to be that when a tag is specified, only
bodies that already have that tag will be updated.
|
| | |
|
| |
| |
| |
| |
| | |
As I understand it, the expectation is to replace any existing tags
with both the tag from the UI and the tags from the csv.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously the call to public_body.send would return the value for
the default locale if no value was set in the current locale,
meaning that translations for attributes that were the same as
the attribute values in the default locale were not being loaded.
Fixes #2134.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
spec/models/public_body_spec.rb
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Also fixes #empty_translation? to check for String and Symbol keys named
'locale'.
Specs use a pre-change check to assert difference.
For some reason rspec change matcher fails with 'nil is not a symbol'.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
String#capitalize downcases remaining letters, so:
> 'heLLo WorLd'.capitalize
# => "Hello world"
Our version only works on the first character of the String, preserving
the case of the rest of the String:
> 'heLLo WorLd'.sub(/\S/) { |m| Unicode.upcase(m) }
# => 'HeLLo WorLd'
Also handle unicode.
|
| |/
|/| |
|
| | |
|
| |
| |
| |
| |
| | |
Some fields have moved to different models, or exist in translation
tables.
|
|\ \ |
|
| | | |
|
| | | |
|
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Seems more logical to make this one method that figures out what to do
based on file type. Plus, incoming message does so many things, it
seemed like having these related methods be separate would make them
easier to read and understand. Also, email, mobile and login
substitution texts weren't being translated. Finally, I think passing
the censor rules and masks as arguments is a first step in some more
decoupling of models.
|
|/
|
|
| |
It's also used in the web interface and needs to be escaped there.
|
|
|
|
| |
It's required in [PublicBody#type_of_authority]( https://github.com/mysociety/alaveteli/blob/rails-3-develop/app/models/public_body.rb#L343-L347)
|
| |
|