Skip to content

Commit 2802d1d

Browse files
committed
Safely access file folder with optional chaining
1 parent edea69e commit 2802d1d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/lib/components/contents/details/fields/file/file-editor-item.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
}
7777
7878
if (file) {
79-
const { publicPath, entryRelative, hasTemplateTags } = $entryDraft?.files[value].folder ?? {};
79+
const { publicPath, entryRelative, hasTemplateTags } =
80+
$entryDraft?.files[value]?.folder ?? {};
81+
8082
const _folder = entryRelative || hasTemplateTags ? '' : publicPath || '';
8183
8284
return createPath([_folder, decodeURI(file.name.normalize())]);

0 commit comments

Comments
 (0)