Skip to content

Commit

Permalink
Decoupled asset hash calculation from package.json (#10774)
Browse files Browse the repository at this point in the history
refs #9414
refs c9b95b4

- Removed package version from asset hash calculation
- Package version doesn't introduce any value when calculating a hash because Date.now() provides enough randomization on its own
  • Loading branch information
naz committed Jun 5, 2019
1 parent 74d5bf3 commit cb199b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/server/data/meta/asset_url.js
@@ -1,8 +1,7 @@
const crypto = require('crypto'),
config = require('../../config'),
imageLib = require('../../lib/image'),
urlService = require('../../services/url'),
packageInfo = require('../../../../package.json');
urlService = require('../../services/url');

/**
* Serve either uploaded favicon or default
Expand Down Expand Up @@ -39,7 +38,7 @@ function getAssetUrl(path, hasMinFile) {
// Ensure we have an assetHash
// @TODO rework this!
if (!config.get('assetHash')) {
config.set('assetHash', (crypto.createHash('md5').update(packageInfo.version + Date.now()).digest('hex')).substring(0, 10));
config.set('assetHash', (crypto.createHash('md5').update(Date.now().toString()).digest('hex')).substring(0, 10));
}

// Finally add the asset hash to the output URL
Expand Down

0 comments on commit cb199b1

Please sign in to comment.