Skip to content

Commit

Permalink
mod_base: fix an issue in page scomp where a wrong URL could be gener…
Browse files Browse the repository at this point in the history
…ated (0.x) (#3296)
  • Loading branch information
mworrell committed Feb 17, 2023
1 parent fd14a63 commit 66bc219
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions modules/mod_base/scomps/scomp_base_pager.erl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
%% @author Marc Worrell <marc@worrell.nl>
%% @copyright 2009-2015 Marc Worrell
%% Date: 2009-04-18
%% @copyright 2009-2023 Marc Worrell
%% @doc Show the pager for the search result

%% Copyright 2009-2015 Marc Worrell
%% Copyright 2009-2023 Marc Worrell
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -242,23 +241,23 @@ pages(Page, Pages) ->
{Start1, Slider3, End}.

urls(Start, Slider, End, IsEstimated, Dispatch, DispatchArgs, Context) ->
Start1 = [ {N, z_dispatcher:url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- Start ],
Start1 = [ {N, url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- Start ],
BeforeSlider =
case Slider of
[] ->
[];
[N1Slider|_] ->
[ {undefined, z_dispatcher:url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- [N1Slider-1] ]
[ {undefined, url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- [N1Slider-1] ]
end,
Slider1 = [ {N, z_dispatcher:url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- Slider ],
Slider1 = [ {N, url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- Slider ],
AfterSlider =
case Slider of
[] ->
[];
[_|_] ->
[ {undefined, z_dispatcher:url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- [lists:last(Slider)+1] ]
[ {undefined, url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- [lists:last(Slider)+1] ]
end,
End1 = [ {N, z_dispatcher:url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- End ],
End1 = [ {N, url_for(Dispatch, [{page,N}|DispatchArgs], Context)} || N <- End ],

case {Start1, Slider1, End1} of
{[], S, []} -> S;
Expand Down

0 comments on commit 66bc219

Please sign in to comment.