@@ -15,7 +15,7 @@ use dav_server::{
1515 ReadDirMeta ,
1616 } ,
1717} ;
18- use futures_util:: future:: FutureExt ;
18+ use futures_util:: future:: { ready , FutureExt } ;
1919use path_slash:: PathBufExt ;
2020use tracing:: { debug, error, trace} ;
2121use zip:: write:: { FileOptions , ZipWriter } ;
@@ -277,6 +277,7 @@ impl DavFileSystem for AliyunDriveFileSystem {
277277 updated_at : DateTime :: new ( now) ,
278278 size : size. unwrap_or ( 0 ) ,
279279 url : None ,
280+ content_hash : None ,
280281 } ;
281282 let mut uploading = self . uploading . entry ( parent_file. id . clone ( ) ) . or_default ( ) ;
282283 uploading. push ( file. clone ( ) ) ;
@@ -512,6 +513,40 @@ impl DavFileSystem for AliyunDriveFileSystem {
512513 }
513514 . boxed ( )
514515 }
516+
517+ fn have_props < ' a > (
518+ & ' a self ,
519+ _path : & ' a DavPath ,
520+ ) -> std:: pin:: Pin < Box < dyn futures_util:: Future < Output = bool > + Send + ' a > > {
521+ Box :: pin ( ready ( true ) )
522+ }
523+
524+ fn get_prop ( & self , dav_path : & DavPath , prop : dav_server:: fs:: DavProp ) -> FsFuture < Vec < u8 > > {
525+ let path = self . normalize_dav_path ( dav_path) ;
526+ debug ! ( path = %path. display( ) , "fs: get_prop" ) ;
527+ async move {
528+ if prop. namespace . as_deref ( ) == Some ( "http://owncloud.org/ns" )
529+ && prop. prefix . as_deref ( ) == Some ( "oc" )
530+ && prop. name == "checksums"
531+ {
532+ let file = self . get_file ( path) . await ?. ok_or ( FsError :: NotFound ) ?;
533+ if let Some ( sha1) = file. content_hash {
534+ let checksums = format ! ( "sha1:{}" , sha1. to_ascii_lowercase( ) ) ;
535+ let xml = format ! (
536+ r#"<?xml version="1.0"?>
537+ <oc:checksums xmlns:d="DAV:" xmlns:nc="http://nextcloud.org/ns" xmlns:oc="http://owncloud.org/ns">
538+ <oc:checksum>{}</oc:checksum>
539+ </oc:checksums>
540+ "# ,
541+ checksums
542+ ) ;
543+ return Ok ( xml. into_bytes ( ) ) ;
544+ }
545+ }
546+ Err ( FsError :: NotImplemented )
547+ }
548+ . boxed ( )
549+ }
515550}
516551
517552#[ derive( Debug , Clone ) ]
0 commit comments