Image check in lambda handler

This commit is contained in:
Dylan 2022-05-26 16:13:31 +01:00
parent 77b972a1b2
commit ec1f4dc284

View file

@ -117,6 +117,9 @@ def genImageFromURL(urlArray):
def lambda_handler(event, context): def lambda_handler(event, context):
images = event["queryStringParameters"].get("imgs","").split(",") images = event["queryStringParameters"].get("imgs","").split(",")
for img in images:
if not img.startswith("https://pbs.twimg.com"):
return {'statusCode':400,'body':'Invalid image URL'}
combined = genImageFromURL(images) combined = genImageFromURL(images)
buffered = BytesIO() buffered = BytesIO()
combined.save(buffered,format="JPEG",quality=60) combined.save(buffered,format="JPEG",quality=60)