Skip to content

Commit

Permalink
seo_sitemap: fix a problem where resources were not final-checked for…
Browse files Browse the repository at this point in the history
… inclusion in the sitemap.

This could lead to inclusion of resources which were visible when creating the sitemap but not anymore when serving the sitemap.
A scenario where this could happen is with major changes in the ACL, without rebuilding the sitemap (which should be done after ACL changes).
  • Loading branch information
mworrell committed Nov 26, 2021
1 parent cb2b6dd commit 6853ba6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions modules/mod_seo_sitemap/models/m_seo_sitemap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,19 @@ slice( Offset, Limit, Context ) ->
fun
(#{ publication_end := PubEnd }) when is_tuple(PubEnd), PubEnd < Now ->
false;
(Url) ->
(#{ loc := Loc } = Url) ->
case is_visible(Url, LangsB, AnonContext) of
true ->
Map = #{ loc := Loc } = maps:from_list(Url),
Map1 = Map#{
Url1 = Url#{
loc => z_context:abs_url(Loc, AnonContext)
},
Map2 = maybe_add_category_attrs(Map1, AnonContext),
{true, Map2};
Url2 = maybe_add_category_attrs(Url1, AnonContext),
{true, Url2};
false ->
false
end
end,
Rows),
lists:map(fun maps:from_list/1, Rows)),
{ok, Rows1}
end.

Expand Down
2 changes: 1 addition & 1 deletion modules/mod_seo_sitemap/support/seo_sitemap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ categories(Context) ->
partition(Count, PageSize) ->
partition(1, Count, PageSize, []).

partition(Start, Count, _PageSize, Acc) when Start >= Count ->
partition(Start, Count, _PageSize, Acc) when Start > Count ->
lists:reverse(Acc);
partition(Start, Count, PageSize, Acc) ->
P = #{
Expand Down

0 comments on commit 6853ba6

Please sign in to comment.