Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,15 @@ path_to_id("/", Context) ->
path_to_id(Path, Context) ->
case string:tokens(Path, "/") of
["page", Id | _] ->
{ok, erlang:list_to_integer(Id)};
case m_rsc:rid(Id, Context) of
undefined -> {error, enoent};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pasqu4le should this be treated as a page path then if it is not page/id? so it still checks m_rsc:page_path_to_id, like in the else of the case above this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be treated as a page path then if it is not page/id?

Good question, but I don't think so. If the path starts with "page" then it's handled by the page dispatch/controller and it should have an identifier (id or otherwise).

If it's not, I don't think we should treat it as another path.

RscId -> {ok, RscId}
end;
[_Language, "page", Id | _] ->
{ok, erlang:list_to_integer(Id)};
case m_rsc:rid(Id, Context) of
undefined -> {error, enoent};
RscId -> {ok, RscId}
end;
_ ->
case m_rsc:page_path_to_id(Path, Context) of
{redirect, Id} ->
Expand Down