Skip to content

Commit

Permalink
Extract repo name from URL, not from DOM
Browse files Browse the repository at this point in the history
The repository name is currently being extracted from an HTMLElement
that should be present in the DOM (but that currently is not present in
every page). Change this method for one that uses the URL to extract
the repository name, so it's more trustworthy.
  • Loading branch information
tgirardi committed Jun 19, 2015
1 parent 4e50b01 commit a89d734
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/github-sublime.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
* Repository Name (we get this from the DOM)
* @type {string}
*/
var repoName = $('.js-current-repository').text();
var repoName;
var pathnameParts = window.location.pathname.split('/');
if(pathnameParts.length > 2) {
repoName = pathnameParts[2];
}

// we can't continue if we could get a repository name
if(!repoName) {
Expand Down

0 comments on commit a89d734

Please sign in to comment.