@@ -399,17 +399,21 @@ const versions_dir_cache = new LRUCache({
399
399
} ,
400
400
validate : async ( { stat, ver_dir_stat } , { dir_path, fs_context } ) => {
401
401
const new_stat = await nb_native ( ) . fs . stat ( fs_context , dir_path ) ;
402
- if ( ver_dir_stat ) {
403
- const versions_dir_path = path . normalize ( path . join ( dir_path , '/' , HIDDEN_VERSIONS_PATH ) ) ;
404
- const new_versions_stat = await nb_native ( ) . fs . stat ( fs_context , versions_dir_path ) ;
405
- return ( new_stat . ino === stat . ino &&
406
- new_stat . mtimeNsBigint === stat . mtimeNsBigint &&
407
- new_versions_stat . ino === ver_dir_stat . ino &&
408
- new_versions_stat . mtimeNsBigint === ver_dir_stat . mtimeNsBigint ) ;
409
- } else {
410
- return ( new_stat . ino === stat . ino &&
411
- new_stat . mtimeNsBigint === stat . mtimeNsBigint ) ;
402
+ const versions_dir_path = path . normalize ( path . join ( dir_path , '/' , HIDDEN_VERSIONS_PATH ) ) ;
403
+ let new_versions_stat ;
404
+ try {
405
+ new_versions_stat = await nb_native ( ) . fs . stat ( fs_context , versions_dir_path ) ;
406
+ } catch ( err ) {
407
+ if ( err . code === 'ENOENT' ) {
408
+ dbg . log0 ( 'NamespaceFS: Version dir not found, ' , versions_dir_path ) ;
409
+ } else {
410
+ throw err ;
411
+ }
412
412
}
413
+ return ( new_stat . ino === stat . ino &&
414
+ new_stat . mtimeNsBigint === stat . mtimeNsBigint &&
415
+ new_versions_stat ?. ino === ver_dir_stat ?. ino &&
416
+ new_versions_stat ?. mtimeNsBigint === ver_dir_stat ?. mtimeNsBigint ) ;
413
417
} ,
414
418
item_usage : ( { usage } , dir_path ) => usage ,
415
419
max_usage : config . NSFS_DIR_CACHE_MAX_TOTAL_SIZE ,
0 commit comments