Skip to content

Commit 9c415ae

Browse files
author
杂粮煎饼
authored
Merge pull request #2 from lisong/master
修改由于 code-push 的 release 命令发布热更新可能导致hash值不同bug (lisong#236)
2 parents 6fd2da1 + 3442698 commit 9c415ae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/utils/security.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ security.packageHashSync = function (jsonData) {
6969
log.debug('packageHashSync manifestData:', manifestData);
7070
var manifestString = JSON.stringify(manifestData.sort());
7171
manifestString = _.replace(manifestString, /\\\//g, '/');
72-
log.debug('packageHashSync manifestString:', manifestData);
72+
log.debug('packageHashSync manifestString:', manifestString);
7373
return security.stringSha256Sync(manifestString);
7474
}
7575

@@ -202,6 +202,10 @@ security.calcAllFileSha256 = function (directoryPath) {
202202
var data = {};
203203
_.forIn(results, (value, key) => {
204204
var relativePath = path.relative(directoryPath, key);
205+
var matchresult = relativePath.match(/(\/|\\).*/);
206+
if (matchresult) {
207+
relativePath = path.join('CodePush', matchresult[0]);
208+
}
205209
relativePath = slash(relativePath);
206210
data[relativePath] = value;
207211
});

0 commit comments

Comments
 (0)