@@ -249,6 +249,7 @@ impl DavFileSystem for AliyunDriveFileSystem {
249249 self . clone ( ) ,
250250 file,
251251 parent_file. id ,
252+ parent_path. to_path_buf ( ) ,
252253 options. size . unwrap_or_default ( ) ,
253254 )
254255 } else if options. write && ( options. create || options. create_new ) {
@@ -279,7 +280,13 @@ impl DavFileSystem for AliyunDriveFileSystem {
279280 } ;
280281 let mut uploading = self . uploading . entry ( parent_file. id . clone ( ) ) . or_default ( ) ;
281282 uploading. push ( file. clone ( ) ) ;
282- AliyunDavFile :: new ( self . clone ( ) , file, parent_file. id , size. unwrap_or ( 0 ) )
283+ AliyunDavFile :: new (
284+ self . clone ( ) ,
285+ file,
286+ parent_file. id ,
287+ parent_path. to_path_buf ( ) ,
288+ size. unwrap_or ( 0 ) ,
289+ )
283290 } else {
284291 return Err ( FsError :: NotFound ) ;
285292 } ;
@@ -530,11 +537,11 @@ impl Default for UploadState {
530537 }
531538}
532539
533- #[ derive( Clone ) ]
534540struct AliyunDavFile {
535541 fs : AliyunDriveFileSystem ,
536542 file : AliyunFile ,
537543 parent_file_id : String ,
544+ parent_dir : PathBuf ,
538545 current_pos : u64 ,
539546 upload_state : UploadState ,
540547}
@@ -551,11 +558,18 @@ impl Debug for AliyunDavFile {
551558}
552559
553560impl AliyunDavFile {
554- fn new ( fs : AliyunDriveFileSystem , file : AliyunFile , parent_file_id : String , size : u64 ) -> Self {
561+ fn new (
562+ fs : AliyunDriveFileSystem ,
563+ file : AliyunFile ,
564+ parent_file_id : String ,
565+ parent_dir : PathBuf ,
566+ size : u64 ,
567+ ) -> Self {
555568 Self {
556569 fs,
557570 file,
558571 parent_file_id,
572+ parent_dir,
559573 current_pos : 0 ,
560574 upload_state : UploadState {
561575 size,
@@ -841,7 +855,7 @@ impl DavFile for AliyunDavFile {
841855 }
842856 self . fs
843857 . remove_uploading_file ( & self . parent_file_id , & self . file . name ) ;
844- self . fs . dir_cache . invalidate_all ( ) ;
858+ self . fs . dir_cache . invalidate ( & self . parent_dir ) . await ;
845859 }
846860 Ok ( ( ) )
847861 }
0 commit comments