Skip to content

Update editor redirect link format

Administrator requested to merge bee/editor-endpoint-update into main

Created by: abeatrix

Currently, our editor endpoint is adding line range as url fragment (link to code) that does not support image preview (report by a user here).

This PR is to fix the editor endpoint so that we could use the editor enpoint to generate a URL in the correct format that supports image preview.

Adding line range as Query has resolved the issue: fix (Note: deploy-sourcegraph was cloned using ssh & sourcegraph repo was cloned using https.)

Before this PR, we would redirect in this order using the editor endpoint https://sourcegraph.com/-/editor?remote_url=https%3A%2F%2Fgithub.com%2Fsourcegraph%2Fsourcegraph.git&branch=main&file=.mocharc.js&editor=VSCode&version=0.0.1&start_row=3&start_col=22&end_row=3&end_col=22 > https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/.mocharc.js?utm_source=VSCode-0.0.1#L4:23 > https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/.mocharc.js#L4:23 (The image preview for this link would be showing the whole file because we only fetch lineRange from url.Query) image

Using the fix included in this PR: https://sourcegraph.com/-/editor?remote_url=https%3A%2F%2Fgithub.com%2Fsourcegraph%2Fsourcegraph.git&branch=main&file=.mocharc.js&editor=VSCode&version=0.0.1&start_row=3&start_col=22&end_row=3&end_col=22 > https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/.mocharc.js?L4%3A23=&utm_source=VSCode-0.0.1 > https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/.mocharc.js?L4%3A23= This (This would render the image preview correctly) image

Merge request reports

Loading