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 exact redirects. #3965

Merged
merged 3 commits into from
Apr 19, 2018
Merged

Fix exact redirects. #3965

merged 3 commits into from
Apr 19, 2018

Conversation

ericholscher
Copy link
Member

Exact redirects depend on the full path being set against, so that you can do things like redirect versions. This was broken in a previous refactor.

Exact redirects depend on the full path being set against, so that you can do things like redirect versions. This was broken in a previous refactor.
@ericholscher ericholscher requested a review from a team April 18, 2018 08:20
@ericholscher ericholscher added PR: hotfix Pull request applied as hotfix to release and removed PR: hotfix Pull request applied as hotfix to release labels Apr 18, 2018
@ericholscher
Copy link
Member Author

Deployed this as a hotfix for a customer who was broken. Linting errors look unrelated, but probably worth fixing in another PR>

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Changes look good!

I just commented about a minor refactor.

def redirect_exact(self, path, language=None, version_slug=None):
if language and version_slug:
# reconstruct the full path for an exact redirect
full_path = '/{language}/{version_slug}/{path}'.format(
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it better here to use self.get_full_path which uses our resolve_path and handle more cases?

@kylef
Copy link

kylef commented Apr 19, 2018

Hi,

I'm hitting this too in swiftenv. We have an exact redirect from /install.sh to /en/latest/install.sh where CI systems are often configured by installing via this URL that is returning 500. I believe this is the same problem that this PR fixes. Unfortunately as it is commonly used to install Swift on Linux on Travis CI this causes broken CI for a lot of users. I'm placing readthedocs behind CloudFlare so these requests are cached somewhat and not hitting RTD as much, if you think this could be costly to RTD let me know and I'll find alternative solution. I really love the service and want to make sure I am not damaging you in any way.

@ericholscher I'm not sure what the time-line looks like to get this PR into production. You mentioned you've deployed a hot-fix for a specific customer. Is it possible to get this fix applied to my project swiftenv if the PR won't land soon? I'd really appreciate it.

I looked into the failing build regarding lint but that seems to be reporting problems that are elsewhere than changed in this PR. Are these failing files expected?

lint runtests: commands[1] | prospector --profile-path=/home/travis/build/rtfd/readthedocs.org --profile=prospector --die-on-tool-error
Messages
========
bookmarks/views.py
  Line: 35
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 15)
  Line: 65
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 19)
  Line: 71
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 15)
  Line: 102
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 15)
  Line: 141
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 15)
    pylint: http-response-with-json-dumps / Instead of HttpResponse(json.dumps(data)) use JsonResponse(data) (col 15)
  Line: 196
    pylint: http-response-with-content-type-json / Instead of HttpResponse(content_type='application/json') use JsonResponse() (col 15)
    pylint: http-response-with-json-dumps / Instead of HttpResponse(json.dumps(data)) use JsonResponse(data) (col 15)

@agjohnson
Copy link
Contributor

@kylef When we apply the hotfix label, it means the fix is already in production, we just need to circle back to an actual release with the hotfix. It seems you could be hitting additional problems introduced by this hotfix. I can reproduce the 5xx error by going to:
http://swiftenv.fuller.li/install.sh

Attaching https://sentry.io/read-the-docs/readthedocs-org/issues/530998543/

@agjohnson agjohnson added this to the 2.4 milestone Apr 19, 2018
@agjohnson
Copy link
Contributor

@kylef We're going to test your case on this next deploy. Best to follow up on a separate issue next though, as this is getting merged for our release.

@agjohnson agjohnson merged commit 6664f35 into master Apr 19, 2018
@agjohnson agjohnson deleted the fix-exact-redirects branch April 19, 2018 16:44
@kylef
Copy link

kylef commented Apr 19, 2018

@agjohnson My apologies, I would have normally filed a separate issue but while trying to find the commit that introduced the possible breakage I discovered this PR (which at the time I though was not deployed). I looked at the test case and though it was the same problem. Will file another shortly.

@humitos
Copy link
Member

humitos commented Apr 24, 2018

@kylef I think your issue is solved.

@kylef
Copy link

kylef commented Apr 24, 2018

I think it is, thanks @humitos and whomever else that involved in fixing it. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: hotfix Pull request applied as hotfix to release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants