Skip to content

Commit 5986791

Browse files
authored
Merge pull request #409 from dbettini/master
Resolve storage asset keys as JSON paths
2 parents c78bcc1 + f5c908c commit 5986791

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/shared/storage/helpers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const Promise = require('bluebird');
1010
const storage = require('./index');
1111
const toPairs = require('lodash/toPairs');
1212
const values = require('lodash/values');
13+
const set = require('lodash/set');
1314

1415
const STORAGE_PROTOCOL = 'storage://';
1516
const PRIMITIVES = ['HTML', 'TABLE-CELL', 'IMAGE', 'BRIGHTCOVE_VIDEO', 'VIDEO', 'EMBED'];
@@ -80,9 +81,10 @@ async function resolveStatics(item) {
8081
if (!element.data.assets) return element;
8182
await Promise.map(toPairs(element.data.assets), async ([key, url]) => {
8283
const isStorageResource = url.startsWith(STORAGE_PROTOCOL);
83-
element.data[key] = isStorageResource
84+
const resolvedUrl = isStorageResource
8485
? (await getFileUrl(url.substr(STORAGE_PROTOCOL.length, url.length)))
8586
: url;
87+
set(element.data, key, resolvedUrl);
8688
});
8789
return element;
8890
}

0 commit comments

Comments
 (0)