Skip to content

Commit

Permalink
moved fetcher determination after URL adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryguyrg committed Jun 16, 2015
1 parent e7bf77e commit 25abf7d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions web/helpers/load_gist.js
Expand Up @@ -213,20 +213,21 @@ exports.load_gist = function (id, cache, options, callback) {

Gists.getById({id: id}, {}, function (err, data) {
var gist = data.results;

var fetcher;
if (id.match(/^http:\/\//i)) {
fetcher = fetchFromUrl;
} else {
fetcher = fetchGithubGist;
}

if (!err && gist && gist.id) {
id = gist.url
}

id = exports.transformThirdPartyURLs(id);

if (id.match(/^http:\/\//i)) {
fetcher = fetchFromUrl;
console.log('Fetching from URL ' + id);
} else {
fetcher = fetchGithubGist;
console.log('Fetching from Gist' + id);
}

for (var fetch in internal.fetchers) {
if (id.indexOf(fetch) === 0) {
id = id.replace(new RegExp('^' + fetch), '')
Expand Down

0 comments on commit 25abf7d

Please sign in to comment.