File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1263,9 +1263,18 @@ async fn export_path_impl(
12631263 }
12641264 MemOrFile :: File ( ( source_path, size) ) => match mode {
12651265 ExportMode :: Copy => {
1266- let source = fs:: File :: open ( & source_path) ?;
1267- let mut target = fs:: File :: create ( & target) ?;
1268- copy_with_progress ( & source, size, & mut target, tx) . await ?
1266+ tx. try_send ( ExportProgressItem :: CopyProgress ( 0 ) )
1267+ . await
1268+ . map_err ( |_e| io:: Error :: other ( "" ) ) ?;
1269+ let written = reflink_copy:: reflink_or_copy ( & source_path, & target) ?;
1270+ if let Some ( written) = written {
1271+ if written != size {
1272+ return Err ( io:: Error :: other ( format ! (
1273+ "wrote {written} bytes, expected {size}" ,
1274+ ) )
1275+ . into ( ) ) ;
1276+ }
1277+ }
12691278 }
12701279 ExportMode :: TryReference => {
12711280 match std:: fs:: rename ( & source_path, & target) {
You can’t perform that action at this time.
0 commit comments