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

Conversation

Projects
None yet
4 participants
@ericholscher
Member

ericholscher commented Apr 18, 2018

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.

Fix exact redirects.
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 rtfd/core Apr 18, 2018

@ericholscher ericholscher added PR: hotfix and removed PR: hotfix labels Apr 18, 2018

@ericholscher

This comment has been minimized.

Member

ericholscher commented Apr 18, 2018

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

@humitos

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(

This comment has been minimized.

@humitos

humitos Apr 18, 2018

Member

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

@kylef

This comment has been minimized.

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

This comment has been minimized.

Contributor

agjohnson commented Apr 19, 2018

@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

This comment has been minimized.

Contributor

agjohnson commented Apr 19, 2018

@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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@agjohnson agjohnson deleted the fix-exact-redirects branch Apr 19, 2018

@kylef

This comment has been minimized.

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

This comment has been minimized.

Member

humitos commented Apr 24, 2018

@kylef I think your issue is solved.

@kylef

This comment has been minimized.

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