-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Perform redirects at DB level #6398
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fd66a6a
Perform redirects at DB level
humitos ca3f3f9
Trigger redirect logic from El Proxito
humitos 03ce54a
Use Func(function='replace') for exact redirect
humitos 49f6425
Try approach with substr instead of replace
ericholscher b29f745
Fix query to do an exact compares
ericholscher 455f469
Merge remote-tracking branch 'origin/master' into humitos/redirects-a…
humitos 6b44283
Define proper output_field on annotation
humitos ed587cf
Fix redirect_type for htmldir
humitos 662ceb8
Rename from_length to from_url_length
humitos 067934e
Merge branch 'master' into humitos/redirects-at-db-level
humitos 45ed017
Log redirects
humitos 5a4f3d5
Merge branch 'humitos/redirects-at-db-level' of github.com:readthedoc…
humitos e387a64
Full log for redirect
humitos aaaa584
Perform redirects on El Proxito 404 handler
humitos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ def get_redirect_response(request, full_path): | |
language, version_slug, path = language_and_version_from_path(path) | ||
|
||
path, http_status = project.redirects.get_redirect_path_with_status( | ||
path=path, language=language, version_slug=version_slug | ||
path=path, full_path=full_path, language=language, version_slug=version_slug | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why we weren't passing this Passing it at this point, allows us to use it as a value to compare at db level instead from Python itself. |
||
) | ||
|
||
if path is None: | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure why we need the
lang_slug
andversion_slug
here. It feels a bit weird. I looked through the code and they're used a couple places, but they don't seem necessary. I wonder if we can just remove it and simplify the redirects code accordingly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't take a deep look at this on purpose. I didn't want to refactor all this without being sure that this is the direction we want to move forward but besides, because we are changing the whole logic of redirects and I felt it was too much. I'm opening an issue to track this refactor.