Skip to content

Commit

Permalink
Lowercase style for previews
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed May 2, 2021
1 parent f703251 commit c277efb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/api/clients.py
Expand Up @@ -58,6 +58,9 @@ async def preview_image(request, id: str, lines: list[str], style: str):
logger.error(f"No such template: {id}")
template = models.Template.objects.get("_error")

if style and "://" not in style:
style = style.lower()

data, content_type = await asyncio.to_thread(
utils.images.preview, template, lines, style=style
)
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions templates/_test/config.yml
Expand Up @@ -19,6 +19,7 @@ text:
scale_y: 0.2
styles:
- default
- sample
example:
- your text
- goes here
Expand Down

0 comments on commit c277efb

Please sign in to comment.