diff --git a/core/src/actions/mediaLibrary.ts b/core/src/actions/mediaLibrary.ts index e9fe4a93..fff37f9b 100644 --- a/core/src/actions/mediaLibrary.ts +++ b/core/src/actions/mediaLibrary.ts @@ -293,14 +293,11 @@ export function persistMedia(file: File, opts: MediaOptions = {}) { }); } } else if (privateUpload) { + console.error('The Private Upload option is only available for Asset Store Integration') throw new Error('The Private Upload option is only available for Asset Store Integration'); } else { const entry = state.entryDraft.entry; - if (!entry?.collection) { - return; - } - - const collection = state.collections[entry?.collection]; + const collection = entry?.collection ? state.collections[entry.collection] : null; const path = selectMediaFilePath(config, collection, entry, fileName, field); assetProxy = createAssetProxy({ file, diff --git a/core/src/reducers/mediaLibrary.ts b/core/src/reducers/mediaLibrary.ts index 680c4034..b1db0021 100644 --- a/core/src/reducers/mediaLibrary.ts +++ b/core/src/reducers/mediaLibrary.ts @@ -346,18 +346,14 @@ function mediaLibrary( export function selectMediaFiles(state: RootState, field?: Field): MediaFile[] { const { mediaLibrary, entryDraft } = state; - if (!entryDraft.entry) { - return []; - } - const editingDraft = selectEditingDraft(entryDraft); const integration = selectIntegration(state, null, 'assetStore'); let files: MediaFile[] = []; if (editingDraft && !integration) { - const entryFiles = (get(entryDraft, ['entry', 'mediaFiles']) ?? []) as MediaFile[]; + const entryFiles = entryDraft?.entry?.mediaFiles ?? []; const entry = entryDraft['entry']; - const collection = state.collections[entry?.collection]; + const collection = entry?.collection ? state.collections[entry.collection] : null; if (state.config.config) { const mediaFolder = selectMediaFolder(state.config.config, collection, entry, field); files = entryFiles diff --git a/website/content/docs/start-with-a-template.mdx b/website/content/docs/start-with-a-template.mdx index 4fb06bca..511a5109 100644 --- a/website/content/docs/start-with-a-template.mdx +++ b/website/content/docs/start-with-a-template.mdx @@ -29,7 +29,7 @@ You can add Static CMS [to an existing site](/docs/add-to-your-site/), but the q
Hugo Site Starter

- + Deploy to Netlify

@@ -56,7 +56,7 @@ You can add Static CMS [to an existing site](/docs/add-to-your-site/), but the q
Gatsby Site Starter

- + Deploy to Netlify