Skip to content

Browser extension: fix GitHub file info detection

Warren Gifford requested to merge fix-file-info-github into master

Created by: chrismwendt

Prior to this change, the revision was found by inspecting the branch/tree button and whether or not the text was truncated. That seemed error-prone to me.

After this change, the file path is found first (by inspecting the "Copy path" button), then the revision is derived from that and the URL. This seems a bit more robust and simpler.

Test plan: make sure the "Open on Sourcegraph" button appears in the file header for these:

Fixes https://github.com/sourcegraph/sourcegraph/issues/4280

Test Plan

Code Hosts
  • GitHub
  • GitHub Enterprise
  • Refined GitHub
  • Phabricator
  • Phabricator integration
  • Bitbucket
  • Gitlab
Browsers
  • Chrome
  • Firefox

Merge request reports

Loading