diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 18eee65..8a0bf78 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,7 @@ Feel free to open a PR before all of these items have been completed. Pull Request Checklist + - [ ] Pull request has been made against `dev` branch. - [ ] Pull request includes a description of the change and the reason behind it. - [ ] Pull request [uses keywords](https://help.github.com/en/articles/closing-issues-using-keywords) to close relevant [issues](https://github.com/uptake/autofocus/issues). - [ ] Pull request includes unit tests for any new functionality. @@ -11,4 +12,4 @@ Maintainer's responsibilities: - [ ] `_version.py` has been updated. - [ ] `CHANGELOG.md` has been updated. - [ ] Updated app container has been pushed, if relevant, with current version number. -- [ ] App container version number has been updated in README. +- [ ] App container version number has been updated everywhere in README. diff --git a/CHANGELOG.md b/CHANGELOG.md index 30f2432..5e523b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +# [1.2.4] - 2019-10-13 +### Changed + - Service gets image file extensions from `mimetypes` instead of using a hard-coded list. + # [1.2.3] - 2019-8-22 ### Changed - Tests and instructions now refer to "localhost" instead of "0.0.0.0". diff --git a/autofocus/_version.py b/autofocus/_version.py index bc86c94..b3f9ac7 100644 --- a/autofocus/_version.py +++ b/autofocus/_version.py @@ -1 +1 @@ -__version__ = "1.2.2" +__version__ = "1.2.4" diff --git a/autofocus/predict/app/requests/Validator.py b/autofocus/predict/app/requests/Validator.py index 0381246..6247ae5 100644 --- a/autofocus/predict/app/requests/Validator.py +++ b/autofocus/predict/app/requests/Validator.py @@ -1,11 +1,14 @@ +import mimetypes from abc import ABC, abstractmethod from flask import abort, jsonify, make_response from flask_api import status -ALLOWED_IMAGE_FILES = set(["png", "jpg", "jpeg", "gif", "bmp"]) -ALLOWED_ZIP_FILES = {"zip"} +ALLOWED_IMAGE_FILES = set( + k for k, v in mimetypes.types_map.items() if v.startswith("image/") +) +ALLOWED_ZIP_FILES = {".zip"} class Validator(ABC): diff --git a/autofocus/predict/app/utils.py b/autofocus/predict/app/utils.py index 3d21c53..14d4b48 100644 --- a/autofocus/predict/app/utils.py +++ b/autofocus/predict/app/utils.py @@ -11,4 +11,4 @@ def allowed_file(filename, allowed_extensions): bool: whether the filename is in allowed extensions """ - return Path(filename).suffix.lower().replace(".", "") in allowed_extensions + return Path(filename).suffix.lower() in allowed_extensions diff --git a/setup.py b/setup.py index 985abda..4dd63dc 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,6 @@ extras_require={"dev": regular_packages + dev_packages}, author="Greg Gandenberger", author_email="gsganden@gmail.com", - url="https://github.com/UptakeOpenSource/autofocus", + url="https://github.com/uptake/autofocus", long_description_content_type="text/markdown", )