Skip to content

Commit

Permalink
filter on mimetype - image only
Browse files Browse the repository at this point in the history
  • Loading branch information
isaric committed Dec 24, 2023
1 parent bd7df56 commit 3458f18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '3.0'
services:
api:
build: .
build:
context: .
dockerfile: dockerfile-amd64
ports:
- "5000:5000"
- "5678:5678"
Expand Down
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def process(self, content):
return
if "event" in content and "files" in content["event"]:
app.logger.info("Received event contains files")
# TODO: switch to manageable list of channel ids
if "image" not in content["event"]["files"][0]["mimetype"]:
app.logger.info("Received file is not an image")
return
if content["event"]["channel"] in self.read_channels:
detector.detect(content["event"]["files"][0]["url_private_download"])
else:
Expand Down

0 comments on commit 3458f18

Please sign in to comment.