fix: Internal server error during import with nested documents
This commit is contained in:
@@ -82,7 +82,7 @@ class Logger {
|
|||||||
* Debug information
|
* Debug information
|
||||||
*
|
*
|
||||||
* @param category A log message category that will be prepended
|
* @param category A log message category that will be prepended
|
||||||
* @param extra Arbitrary data to be logged that will appear in prod logs
|
* @param extra Arbitrary data to be logged that will appear in development logs
|
||||||
*/
|
*/
|
||||||
public debug(label: LogCategory, message: string, extra?: Extra) {
|
public debug(label: LogCategory, message: string, extra?: Extra) {
|
||||||
this.output.debug(message, { ...this.sanitize(extra), label });
|
this.output.debug(message, { ...this.sanitize(extra), label });
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ export default class ZipHelper {
|
|||||||
|
|
||||||
let currentLevel = tree; // initialize currentLevel to root
|
let currentLevel = tree; // initialize currentLevel to root
|
||||||
|
|
||||||
pathParts.forEach(function (name) {
|
pathParts.forEach(function (rawName) {
|
||||||
|
const { name } = path.parse(path.basename(rawName));
|
||||||
|
|
||||||
// check to see if the path already exists.
|
// check to see if the path already exists.
|
||||||
const existingPath = find(currentLevel, {
|
const existingPath = find(currentLevel, {
|
||||||
name,
|
name,
|
||||||
@@ -69,13 +71,13 @@ export default class ZipHelper {
|
|||||||
// The path to this item was already in the tree, so don't add again.
|
// The path to this item was already in the tree, so don't add again.
|
||||||
// Set the current level to this path's children
|
// Set the current level to this path's children
|
||||||
currentLevel = existingPath.children;
|
currentLevel = existingPath.children;
|
||||||
} else if (name.endsWith(".DS_Store") || !name) {
|
} else if (rawName.endsWith(".DS_Store") || !rawName) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
const newPart = {
|
const newPart = {
|
||||||
name,
|
name,
|
||||||
path: filePath.replace(/^\//, ""),
|
path: filePath.replace(/^\//, ""),
|
||||||
title: deserializeFilename(path.parse(path.basename(name)).name),
|
title: deserializeFilename(name),
|
||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user