File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
packages/decap-cms-core/src Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1329,7 +1329,20 @@ export class Backend {
13291329 await this . invokePreUnpublishEvent ( entry ) ;
13301330 let paths = [ path ] ;
13311331 if ( hasI18n ( collection ) ) {
1332- paths = getFilePaths ( collection , extension , path , slug ) ;
1332+ const allPaths = getFilePaths ( collection , extension , path , slug ) ;
1333+ // Filter out non-existent files to prevent deletion errors
1334+ const existingPaths = await Promise . all (
1335+ allPaths . map ( async filePath => {
1336+ try {
1337+ await this . implementation . getEntry ( filePath ) ;
1338+ return filePath ;
1339+ } catch ( error ) {
1340+ // File doesn't exist, skip it
1341+ return null ;
1342+ }
1343+ } ) ,
1344+ ) ;
1345+ paths = existingPaths . filter ( ( p ) : p is string => p !== null ) ;
13331346 }
13341347 await this . implementation . deleteFiles ( paths , commitMessage ) ;
13351348
You can’t perform that action at this time.
0 commit comments