Skip to content

Commit

Permalink
🎨 create assetHash if not available in asset_url helper
Browse files Browse the repository at this point in the history
refs #6982
- was before generated in ConfigManager

[ci skip]
  • Loading branch information
kirrg001 authored and ErisDS committed Sep 20, 2016
1 parent 66dbd5f commit f4bee50
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/server/data/meta/asset_url.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var config = require('../../config'),
utils = require('../../utils');
utils = require('../../utils'),
crypto = require('crypto');

function getAssetUrl(path, isAdmin, minify) {
var output = '';
Expand All @@ -25,6 +26,10 @@ function getAssetUrl(path, isAdmin, minify) {
output += path;

if (!path.match(/^favicon\.ico$/)) {
if (!config.get('assetHash')) {
config.set('assetHash', (crypto.createHash('md5').update(config.get('ghostVersion') + Date.now()).digest('hex')).substring(0, 10));
}

output = output + '?v=' + config.get('assetHash');
}

Expand Down

0 comments on commit f4bee50

Please sign in to comment.