From f5af2b21782fefccb62a4683c2841d784de277c2 Mon Sep 17 00:00:00 2001 From: Adam Sclafani <37944482+adamsclafani@users.noreply.github.com> Date: Thu, 30 Jul 2020 05:26:52 -1000 Subject: [PATCH] Fix bugs in Wikipedia mailer (#487) * Fix broken shellcheck mirror URL * Update to latest shellcheck release Co-authored-by: Clemens Wolff --- docker/ci/Dockerfile | 4 ++-- opwen_email_server/mailers/wikipedia.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile index cd88bd59..f1bd7694 100644 --- a/docker/ci/Dockerfile +++ b/docker/ci/Dockerfile @@ -6,8 +6,8 @@ RUN wget -q -O /usr/bin/hadolint "https://github.com/hadolint/hadolint/releases/ && chmod +x /usr/bin/hadolint \ && hadolint --version -ARG SHELLCHECK_VERSION=v0.7.0 -RUN wget -q -O /tmp/shellcheck.tar.xz "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.$(uname -m).tar.xz" \ +ARG SHELLCHECK_VERSION=v0.7.1 +RUN wget -q -O /tmp/shellcheck.tar.xz "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.$(uname -m).tar.xz" \ && tar -xJf /tmp/shellcheck.tar.xz -C /usr/bin --strip-components=1 "shellcheck-${SHELLCHECK_VERSION}/shellcheck" \ && rm /tmp/shellcheck.tar.xz \ && shellcheck --version diff --git a/opwen_email_server/mailers/wikipedia.py b/opwen_email_server/mailers/wikipedia.py index 27ec5cb2..b4f33cb1 100644 --- a/opwen_email_server/mailers/wikipedia.py +++ b/opwen_email_server/mailers/wikipedia.py @@ -39,7 +39,7 @@ def __call__(self, email: dict) -> dict: self._language_setter('en') try: - wiki_page = self._page_fetch(email['body']) + wiki_page = self._page_fetch(email['body'].strip()) except DisambiguationError as e: subject = 'Suggested Searches' body = 'Multiple results found. Try again with the following: \n{}'.format('\n'.join(e.options)) @@ -48,7 +48,7 @@ def __call__(self, email: dict) -> dict: body = 'No results found for: {}'.format(email['body']) else: subject = wiki_page.title - body = '' + body = 'Results found' download_link = self._get_download_link(wiki_page.url) pdf_file = get(download_link) email['attachments'] = [{