Skip to content

Commit

Permalink
mod_admin: fix a problem with media preview for unknown resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell committed Jan 24, 2017
1 parent 8c45e94 commit c139bb5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/mod_admin/controllers/controller_admin_media_preview.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ content_types_provided(ReqData, Context) ->

to_image(ReqData, Context) ->
Opts = [{mediaclass, "admin-editor"}],
{ok, Url} = z_media_tag:url(z_context:get(id, Context), Opts, Context),
ReqData1 = wrq:set_resp_header("Location", z_context:abs_url(Url, Context), ReqData),
{{halt, 303}, ReqData1, Context}.
case z_media_tag:url(z_context:get(id, Context), Opts, Context) of
{ok, Url} ->
ReqData1 = wrq:set_resp_header("Location", z_context:abs_url(Url, Context), ReqData),
{{halt, 303}, ReqData1, Context};
{error, enoent} ->
{{halt, 404}, ReqData, Context}
end.

0 comments on commit c139bb5

Please sign in to comment.