Conversation
loetie
reviewed
Feb 9, 2026
| ["page", Id | _] -> | ||
| {ok, erlang:list_to_integer(Id)}; | ||
| case m_rsc:rid(Id, Context) of | ||
| undefined -> {error, enoent}; |
Contributor
There was a problem hiding this comment.
@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?
Contributor
Author
There was a problem hiding this comment.
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.
loetie
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current
controller_rest_resources:path_to_idexpects the page path to contain an integer and fails catastrophically otherwise.I triggered this accidentally while testing for another issue by using a path with text (e.g.
/page/not_existing) whichcontroller_pagecan handle just fine, butcontroller_rest_resourcescrashes on.This fixes the function to accept paths that might contain a resource’s unique name (as
controller_pagedoes) and by not crashing on incorrect inputs (it returns an error tuple instead).