This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Web: fix git blame for files that have /stream/ in their path#64230
Merged
camdencheek merged 2 commits intomainfrom Aug 2, 2024
Merged
Web: fix git blame for files that have /stream/ in their path#64230camdencheek merged 2 commits intomainfrom
/stream/ in their path#64230camdencheek merged 2 commits intomainfrom
Conversation
camdencheek
commented
Aug 2, 2024
| method: 'GET', | ||
| headers: { | ||
| 'X-Requested-With': 'Sourcegraph', | ||
| ...window.context.xhrHeaders, |
Member
Author
There was a problem hiding this comment.
Unrelated drive-by: we're already adding X-Requested-With, so this should be okay, but we should prefer to use the xhr headers sent by the backend.
vovakulikov
approved these changes
Aug 2, 2024
Contributor
vovakulikov
left a comment
There was a problem hiding this comment.
It looks like that path as a URL never has a state where there is no problem with it. LGTM
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The URL path for streaming blame is ambiguous when the file path contains
/stream/. The pattern looks like/blame/<repo_name>@<revision>/stream/file/path.txt. However, if the file contains/stream/, the revision is matched greedily up until the last stream, so we end up with a revision that looks like81af3g/stream/my/path, which is in invalid revision that results in a 404.This makes the URL pattern unambiguous by adding a
/-/element after the revision, which is not allowed in a revision name and acts as a path separator. So now, the pattern looks like/blame/<repo_name>@<revision>/-/stream/file/path.txt.Note, this is a public-facing breaking change, but I don't think it really matters since I don't expect any customers use our streaming blame API
Fixes SRCH-738
Test plan
Tested that blame requests do not fail for files that contain
/stream/Changelog
/stream/