Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back out functionality requiring libjpeg-dev apt dependency #3379

Merged
merged 3 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Simply click the **Update Instance Config** button:

|System Config Page|

And on the instance configuration page, select and upload the image you prefer.
And on the instance configuration page, select and upload the PNG image you prefer.
You should see a message appear indicating the change was a success:

|Logo Update|
Expand Down
2 changes: 1 addition & 1 deletion docs/development/documentation_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To update these screenshots automatically you can run:

.. code:: sh

make -C securedrop images update-user-guides
make -C securedrop update-user-guides

This will generate screenshots for each page in the web application and copy
them to the folder under ``docs/images/manual/screenshots`` where they will
Expand Down
2 changes: 0 additions & 2 deletions install_files/ansible-base/group_vars/all/securedrop
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ development_dependencies:
- devscripts # for dch
- gdb # for gcore in TestSubmissionNotInMemory
- paxctl
- libjpeg-dev

# These profiles are referenced by multiple machines, such as Application Server
# for direct copying at install time, and the build machine for including them
Expand All @@ -53,7 +52,6 @@ appserver_dependencies:
- apparmor-utils
- redis-server
- supervisor
- libjpeg-dev

tor_apt_repo_url: https://tor-apt.freedom.press

Expand Down
2 changes: 1 addition & 1 deletion install_files/securedrop-app-code/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Homepage: https://securedrop.org
Package: securedrop-app-code
Version: 0.7.0~rc1
Architecture: amd64
Depends: python-pip,apparmor-utils,gnupg2,haveged,python,python-pip,secure-delete,sqlite,apache2-mpm-worker,libapache2-mod-wsgi,libapache2-mod-xsendfile,redis-server,supervisor,securedrop-keyring,securedrop-config,libjpeg-dev
Depends: python-pip,apparmor-utils,gnupg2,haveged,python,python-pip,secure-delete,sqlite,apache2-mpm-worker,libapache2-mod-wsgi,libapache2-mod-xsendfile,redis-server,supervisor,securedrop-keyring,securedrop-config
Description: Packages the SecureDrop application code pip dependencies and apparmor profiles. This package will put the apparmor profiles in enforce mode. This package does use pip to install the pip wheelhouse
2 changes: 1 addition & 1 deletion securedrop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt-get update && \
apt-get install -y devscripts \
python-pip libpython2.7-dev libssl-dev secure-delete \
gnupg2 ruby redis-server firefox git xvfb haveged curl \
gettext paxctl x11vnc enchant libjpeg-dev
gettext paxctl x11vnc enchant

RUN gem install sass -v 3.4.23

Expand Down
11 changes: 3 additions & 8 deletions securedrop/journalist_app/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from PIL import Image

import os

from flask import (Blueprint, render_template, request, url_for, redirect, g,
Expand Down Expand Up @@ -33,19 +31,16 @@ def manage_config():
form = LogoForm()
if form.validate_on_submit():
f = form.logo.data
custom_logo_filepath = os.path.join(config.SECUREDROP_ROOT,
"static/i/custom_logo.png")
custom_logo_filepath = os.path.join(current_app.static_folder, 'i',
'custom_logo.png')
try:
with Image.open(f) as im:
im.thumbnail((500, 450), resample=3)
im.save(custom_logo_filepath, "PNG")
f.save(custom_logo_filepath)
flash(gettext("Image updated."), "logo-success")
except Exception:
flash("Unable to process the image file."
" Try another one.", "logo-error")
finally:
return redirect(url_for("admin.manage_config"))

else:
for field, errors in form.errors.items():
for error in errors:
Expand Down
5 changes: 2 additions & 3 deletions securedrop/journalist_app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ReplyForm(FlaskForm):
class LogoForm(FlaskForm):
logo = FileField(validators=[
FileRequired(message=gettext('File required.')),
FileAllowed(['jpg', 'png', 'jpeg'],
message=gettext("You can only upload JPG/JPEG"
" or PNG image files."))
FileAllowed(['png'],
message=gettext("Upload images only."))
])
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ scrypt
SQLAlchemy
typing
Werkzeug==0.12.2
Pillow
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ itsdangerous==0.24 # via flask
jinja2==2.10
jsmin==2.2.2
markupsafe==1.0 # via jinja2
pillow==5.0.0
psutil==5.4.3
pycryptodomex==3.4.7
pyotp==2.2.6
Expand Down
7 changes: 3 additions & 4 deletions securedrop/tests/test_journalist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,9 @@ def test_logo_upload_with_invalid_filetype_fails(self):
resp = self.client.post(url_for('admin.manage_config'),
data=form.data,
follow_redirects=True)
self.assertMessageFlashed("You can only upload JPG/JPEG"
" or PNG image files.", "logo-error")
self.assertIn("You can only upload JPG/JPEG"
" or PNG image files.", resp.data)
self.assertMessageFlashed("Upload images only.",
"logo-error")
self.assertIn("Upload images only.", resp.data)

def test_logo_upload_with_empty_input_field_fails(self):
self._login_admin()
Expand Down