Skip to content

Commit

Permalink
core: check crop_center syntax on rsc update.
Browse files Browse the repository at this point in the history
(cherry picked from commit c8c403b)
  • Loading branch information
mworrell committed Jan 25, 2017
1 parent e7d3736 commit 11ef906
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/models/m_rsc_update.erl
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,19 @@ props_filter([{pref_language, Lang}|T], Acc, Context) ->
props_filter([{language, Langs}|T], Acc, Context) ->
props_filter(T, [{language, filter_languages(Langs)}|Acc], Context);

props_filter([{crop_center, undefined}=H|T], Acc, Context) ->
props_filter(T, [H|Acc], Context);
props_filter([{crop_center, CropCenter}|T], Acc, Context) ->
CropCenter1 = case z_string:trim(CropCenter) of
<<>> -> undefined;
Trimmed ->
case re:run(Trimmed, "^\\+[0-9]+\\+[0-9]+$") of
nomatch -> undefined;
{match, _} -> Trimmed
end
end,
props_filter(T, [{crop_center, CropCenter1}|Acc], Context);

props_filter([{_Prop, _V}=H|T], Acc, Context) ->
props_filter(T, [H|Acc], Context).

Expand Down

0 comments on commit 11ef906

Please sign in to comment.