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

Development Branch: Loading Non-Cached Old URLs That Have '+' #130

Open
nyanginator opened this issue Jun 2, 2018 · 0 comments
Open

Development Branch: Loading Non-Cached Old URLs That Have '+' #130

nyanginator opened this issue Jun 2, 2018 · 0 comments

Comments

@nyanginator
Copy link

nyanginator commented Jun 2, 2018

Currently, old URLs from the URL history only work when there are spaces ' ' instead of '+' signs. For example, let's say:

  • Course with shortname "My Course" has clean url: http://www.example.com/moodle/course/My+Course
  • Shortname is changed to "My Cool Course". Upon saving this edit, it loads the page with the old URL since it is cached, so still: http://www.example.com/moodle/course/My+Course
  • Purge all caches so that on the next try, it will need to load from the URL history in the database.
  • The old URL should still load since it is in the URL history. But trying to load http://www.example.com/moodle/course/My+Course results in "Sorry, the requested file could not be found".
  • Change all '+' signs to spaces ' ' (http://www.example.com/moodle/course/My Course) and the page loads fine, redirecting to the new clean URL: http://www.example.com/moodle/course/My+Cool+Course

Notes:

  • Same behavior applies to course modules, since course module URLs have the course URL in them.
  • The most current URL works, regardless of whether there are spaces ' ' or '+' signs. Only loading of old URLs with '+' signs don't work.
  • The database stores clean URLs without the '+' signs. This is probably why only old URLs without '+' signs work.
  • The '+' signs come from cleaning URLs using the urlencode() function in classes/local/cleaner/cleaner.php.
  • Is there any reason why clean_moodle_url::sluggify() is used only to clean some paths, and urlencode() is used for others? Wouldn't it be better to keep everything consistent with sluggify()?
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

No branches or pull requests

1 participant