Merge branch 'hotfix/21.56.9' into master
[gitter.git] / modules / avatars / server / extract-gravatar-version.js
blob849e90c11e7324bfe98a8759dcff5e4bb416b6f8
1 'use strict';
3 var url = require('url');
5 var GITHUB_AVATARS_HOST_RE = /^avatars\d*\.githubusercontent\.com$/;
7 /* Given a avatar url, get the cache buster */
8 module.exports = function extractGravatarVersion(avatarUrl) {
9 try {
10 var parsed = url.parse(avatarUrl, true, true);
12 if (GITHUB_AVATARS_HOST_RE.test(parsed.hostname)) {
13 return parseInt(parsed.query.v, 10) || undefined;
15 } catch (e) {
16 /* */