diff --git a/aws-s3/s3.ml b/aws-s3/s3.ml index ad02512..bf0ff0b 100644 --- a/aws-s3/s3.ml +++ b/aws-s3/s3.ml @@ -519,7 +519,7 @@ module Make(Io : Types.Io) = struct |> fun etag -> unquote etag in t.parts <- { etag; part_number } :: t.parts; - Deferred.return (Ok ()) + Deferred.return (Ok etag) (** Specify a part to be a file on s3. [range] can be used to only include a part of the s3 file @@ -616,7 +616,7 @@ module Make(Io : Types.Io) = struct |> fun etag -> String.sub ~pos:1 ~len:(String.length etag - 2) etag in t.parts <- { etag; part_number } :: t.parts; - Deferred.return (Ok ()) + Deferred.return (Ok etag) end end diff --git a/aws-s3/s3.mli b/aws-s3/s3.mli index d153d63..051736a 100644 --- a/aws-s3/s3.mli +++ b/aws-s3/s3.mli @@ -216,7 +216,7 @@ module Make(Io : Types.Io) : sig ?expect:bool -> data:string -> unit -> - unit result) command + etag result) command (** Specify a part as a copy of an existing object in S3. *) val copy_part : @@ -255,7 +255,7 @@ module Make(Io : Types.Io) : sig length:int -> chunk_size:int -> unit -> - unit result) command + etag result) command end end diff --git a/cli/aws.ml b/cli/aws.ml index e288060..9cd67ff 100644 --- a/cli/aws.ml +++ b/cli/aws.ml @@ -95,15 +95,18 @@ module Make(Io : Aws_s3.Types.Io) = struct | (false, false) -> failwith "Use cp(1)" let rec upload_parts t endpoint ~retries ~expect ~credentials ?(offset=0) ~total ?(part_number=1) ?chunk_size src = + let ignore_result = Result.map ignore in let f ~size ~endpoint ()= match chunk_size with | None -> let data = read_file ~pos:offset ~len:size src in - S3.Multipart_upload.upload_part ~endpoint ~expect ~credentials t ~part_number ~data () + S3.Multipart_upload.upload_part ~endpoint ~expect ~credentials t ~part_number ~data () >>| + ignore_result | Some chunk_size -> (* Create a reader for this section *) let reader = file_reader ~pos:offset ~len:size src in - S3.Multipart_upload.Stream.upload_part ~endpoint ~expect ~credentials t ~part_number ~data:reader ~chunk_size ~length:size () + S3.Multipart_upload.Stream.upload_part ~endpoint ~expect ~credentials t ~part_number ~data:reader ~chunk_size ~length:size () >>| + ignore_result in match (total - offset) with | 0 -> []