Skip to content

Commit

Permalink
Keep font after text redirect
Browse files Browse the repository at this point in the history
Fixes #223
  • Loading branch information
jacebrowning committed Aug 27, 2016
1 parent f202bbc commit a73a952
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion memegen/routes/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def get_with_text(key, path, alt, font):
return redirect(route('.get', key=key, path=path, alt=alt))

if path != text.path:
return redirect(route('.get', key=key, path=text.path, alt=alt))
return redirect(route(
'.get', key=key, path=text.path, alt=alt, font=font))

image = app.image_service.create(template, text, style=alt, font=fontfile)

Expand Down
7 changes: 7 additions & 0 deletions tests/test_routes_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ def it_redirects_on_unknown_fonts(client):
expect(load(response, as_json=False)).contains(
'<a href="/iw/hello.jpg">')

def it_keeps_font_after_redirect(client):
response = client.get("/iw/what%3F.jpg?font=impact")

expect(response.status_code) == 302
expect(load(response, as_json=False)).contains(
'<a href="/iw/what~q.jpg?font=impact">')

def describe_latest():

def when_existing(client):
Expand Down

0 comments on commit a73a952

Please sign in to comment.