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

Revert hourofcode.com behavior change for Pegasus sitemap #21283

Merged
merged 2 commits into from Mar 16, 2018

Conversation

wjordan
Copy link
Contributor

@wjordan wjordan commented Mar 16, 2018

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!

@wjordan wjordan requested a review from Hamms March 16, 2018 01:28
# We no longer want the country to be part of the path we use to search:
search_uri = File.join('/', [@language, path].compact)
return search_uri if resolve_document(search_uri)
return "/#{path}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just reverts commit bed6c0b.

Prepend 'us' country code to hourofcode.com URIs instead of following redirect.
@wjordan
Copy link
Contributor Author

wjordan commented Mar 16, 2018

Merging this fix now since it's essentially a partial-revert of #21143 to fix some already-broken behavior.

@wjordan wjordan merged commit 7c88ddf into staging Mar 16, 2018
@wjordan wjordan removed the request for review from Hamms March 16, 2018 01:39
@balderdash balderdash deleted the pegasus_sitemap branch September 20, 2018 17:52
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.

None yet

1 participant