Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frontend API url courses regex overlap #362

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

bryanlandia
Copy link
Contributor

Addresses #361 by changing

  • /figures/api/courses/general to /figures/api/courses-general/
  • /figures/api/courses/detail to /figures/api/courses-detail/

Also, just to not have one outlier URL pattern, updates the corresponding

  • /figures/api/users/general to /figures/api/users-general/
  • figures/api/users/detail to /figures/api/users-detail/

These changes shouldn't be problematic in that they are internal API URLs and the documentation has warnings that they are subject to change.

@bryanlandia bryanlandia marked this pull request as draft June 3, 2021 23:17
@bryanlandia bryanlandia force-pushed the bryan/fix-url-courses-regex-overlap branch from 8c22616 to 49aefdf Compare June 3, 2021 23:22
@bryanlandia bryanlandia marked this pull request as ready for review June 3, 2021 23:33
Copy link
Contributor

@johnbaldwin johnbaldwin left a comment

Choose a reason for hiding this comment

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

@bryanlandia This PR has outdated code. Please make sure this passes tests when you merge it back in. I'm going to consider this a "temporary" workaround fix. Why? Because nested resources are valid REST endpoints. Too much nesting is a code smell, but I don't want to box figures out of being able to do endpoints in the future for:

/courses
/courses/some-blah
/courses/some-other-blah

@bryanlandia
Copy link
Contributor Author

@johnbaldwin thanks for the review! Unfortunately because the course id regex is defined in edx-platform code, and evaluated in middleware, any /courses/blah URL pattern is going to run into trouble. I'll merge after rebase as long as all the checks pass.

/courses/general/course-v1... and /courses/detail/course-v1...
will be matched by Open edX request util and other course id REGEX's
as a course with id of general/course-v1 etc. and result in 500 errors
particulary in some middlewares.
Addresses #361
@bryanlandia bryanlandia force-pushed the bryan/fix-url-courses-regex-overlap branch from 49aefdf to d09248a Compare June 10, 2021 23:20
@bryanlandia bryanlandia merged commit ea4f37f into master Jun 10, 2021
@OmarIthawi OmarIthawi deleted the bryan/fix-url-courses-regex-overlap branch March 19, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants