From d99eebd47ebbedf96aa2022739ff8a308df90112 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 12 May 2020 14:48:37 -0700 Subject: [PATCH] fix: sign child paths in order of depth (#228) --- sign.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sign.js b/sign.js index fe57a56..12cafa3 100644 --- a/sign.js +++ b/sign.js @@ -198,6 +198,16 @@ function signApplicationAsync (opts) { } var promise + /** + * Sort the child paths by how deep they are in the file tree. Some arcane apple + * logic expects the deeper files to be signed first otherwise strange errors get + * thrown our way + */ + childPaths = childPaths.sort((a, b) => { + const aDepth = a.split(path.sep).length + const bDepth = b.split(path.sep).length + return bDepth - aDepth + }) if (opts.entitlements) { // Sign with entitlements promise = Promise.mapSeries(childPaths, function (filePath) {