Skip to content

Commit acb645a

Browse files
committed
fixing a bug when the archive entry type is a directory
1 parent f488406 commit acb645a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

electron/app/js/wdtArchive.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ async function getArchiveEntry(window, archiveEntryType, options) {
219219
};
220220
}
221221

222+
let promise;
222223
if (options.showChooser) {
223-
return _getArchiveEntryShowChooser(window, archiveEntryType, options);
224+
promise = _getArchiveEntryShowChooser(window, archiveEntryType, options);
224225
} else {
225-
return _getArchiveEntry(archiveEntryType, options);
226+
promise = _getArchiveEntry(archiveEntryType, options);
226227
}
228+
return promise;
227229
}
228230

229231

@@ -253,6 +255,11 @@ async function _addDirectoryPaths(directory, paths, pathPrefix) {
253255
async function _getArchiveEntryShowChooser(targetWindow, archiveEntryTypeName, archiveEntryTypeOptions) {
254256
// lazy load to allow initialization
255257
const i18n = require('./i18next.config');
258+
const { getLogger } = require('./wktLogging');
259+
const wktLogger = getLogger();
260+
261+
wktLogger.debug('entering _getArchiveEntryShowChooser(%s, %s, %s)',
262+
targetWindow, archiveEntryTypeName, JSON.stringify(archiveEntryTypeOptions));
256263

257264
const result = {};
258265
const archiveEntryType = getEntryTypes()[archiveEntryTypeName];
@@ -287,15 +294,20 @@ async function _getArchiveEntryShowChooser(targetWindow, archiveEntryTypeName, a
287294
result.archiveUpdatePath = result.archivePath;
288295
if (chooserType === 'openDirectory') {
289296
result.archiveUpdatePath = `${result.archivePath}/`;
290-
result.childPaths = _getDirectoryPaths(result.filePath);
297+
result.childPaths = await _getDirectoryPaths(result.filePath);
291298
}
292299
}
300+
wktLogger.debug('exiting _getArchiveEntryShowChooser() with %s', JSON.stringify(result));
293301
return result;
294302
}
295303

296304
async function _getArchiveEntry(archiveEntryTypeName, archiveEntryTypeOptions) {
297305
// lazy load to allow initialization
298306
const i18n = require('./i18next.config');
307+
const { getLogger } = require('./wktLogging');
308+
const wktLogger = getLogger();
309+
310+
wktLogger.debug('entering _getArchiveEntry(%s, %s)', archiveEntryTypeName, JSON.stringify(archiveEntryTypeOptions));
299311

300312
const result = {};
301313
const archiveEntryTypes = getEntryTypes();
@@ -334,8 +346,9 @@ async function _getArchiveEntry(archiveEntryTypeName, archiveEntryTypeOptions) {
334346
result.archiveUpdatePath = result.archivePath;
335347
if (archiveEntryTypes[result.archiveEntryType].subtype !== 'file') {
336348
result.archiveUpdatePath = `${result.archivePath}/`;
337-
result.childPaths = _getDirectoryPaths(result.filePath);
349+
result.childPaths = await _getDirectoryPaths(result.filePath);
338350
}
351+
wktLogger.debug('exiting _getArchiveEntryShowChooser() with %s', JSON.stringify(result));
339352
return result;
340353
}
341354

0 commit comments

Comments
 (0)