Revert hourofcode.com behavior change for Pegasus sitemap #21283
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.
Fixes incorrect behavior-change to hourofcode.com document-resolution introduced in #21143.
hourofcode.com has custom logic to resolve
/:country/:language/:path
URIs to/:language/:path
document paths.#21143 attempted to pass the document paths as-is to the Rack application and then follow redirects to return the result, but to get this to resolve all documents I had to change the path-resolution to incorrectly interpret the language-code-specific document-paths as country-codes.
The correct approach to reduce document paths to URIs that will render correctly in all cases is to just prepend a country code (here I use the default
us
code) to the path. This simplifies the testing behavior as well because following redirects is not needed (and similarly, we don't need to configure the Sinatra application to produce relative redirects instead of absolute ones it does by default).Thanks @Hamms for helping me sort this out!