Skip to content

Commit

Permalink
Check for upload directory for static media
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsee55 committed Jul 25, 2023
1 parent 04adda1 commit 6672cfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/@tinacms/cli/src/next/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ async function listFilesRecursively({
config.publicFolder,
directoryPath
)
const items = await fs.promises.readdir(fullDirectoryPath)
const exists = await fs.pathExists(fullDirectoryPath)
if (!exists) {
return { '0': [] }
}
const items = await fs.readdir(fullDirectoryPath)

const staticMediaItems: StaticMediaItem[] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export class TinaMediaStore implements MediaStore {

constructor(cms: CMS, staticMedia?: StaticMedia) {
this.cms = cms
// if (staticMedia && staticMedia.length) {
if (staticMedia) {
if (staticMedia && Object.keys(staticMedia).length > 0) {
this.isStatic = true
this.staticMedia = staticMedia
}
Expand Down

0 comments on commit 6672cfb

Please sign in to comment.