@@ -26,17 +26,6 @@ class MultipartCopy extends AbstractUploadManager
2626 'REPLACE ' => true ,
2727 ];
2828
29- // copy_props presets: caller-facing top-level switch.
30- private const COPY_PROPS_NONE = 'none ' ;
31- private const COPY_PROPS_METADATA_DIRECTIVE = 'metadata-directive ' ;
32- private const COPY_PROPS_DEFAULT = 'default ' ;
33-
34- private const VALID_COPY_PROPS = [
35- self ::COPY_PROPS_NONE => true ,
36- self ::COPY_PROPS_METADATA_DIRECTIVE => true ,
37- self ::COPY_PROPS_DEFAULT => true ,
38- ];
39-
4029 private const TAGS_DIRECTIVE_UNSPECIFIED = 'UNSPECIFIED ' ;
4130 private const TAGS_DIRECTIVE_COPY = 'COPY ' ;
4231 private const TAGS_DIRECTIVE_REPLACE = 'REPLACE ' ;
@@ -118,36 +107,24 @@ class MultipartCopy extends AbstractUploadManager
118107 * of the multipart upload and that is used to resume a previous upload.
119108 * When this option is provided, the `bucket`, `key`, and `part_size`
120109 * options are ignored.
121- * - copy_props: (string, default='metadata-directive') Top-level preset that
122- * resolves defaults for metadata_directive, tags_directive, and
123- * annotations_directive. Explicit values for those directives take
124- * precedence. Values:
125- * - 'none': nothing is copied. Resolves metadata_directive=REPLACE,
126- * tags_directive=UNSPECIFIED, annotations_directive=EXCLUDE.
127- * - 'metadata-directive': legacy default. Resolves metadata_directive=COPY,
128- * tags_directive=UNSPECIFIED, annotations_directive=UNSPECIFIED.
129- * - 'default': metadata, tags, and annotations are all copied.
130- * Resolves metadata_directive=COPY, tags_directive=COPY,
131- * annotations_directive=COPY.
132- * - metadata_directive: (string) 'COPY' or 'REPLACE'. Defaults to COPY,
133- * except when `copy_props` is 'none' (then REPLACE). Caller-supplied
134- * `params['Metadata']` does NOT change the directive — set this option
135- * explicitly to opt into REPLACE. When 'COPY', source metadata fields
136- * (Metadata, CacheControl, ContentDisposition, ContentEncoding,
137- * ContentLanguage, ContentType, Expires) are forwarded and any
138- * matching caller-supplied fields are dropped. When 'REPLACE', no
139- * source metadata is read and caller-supplied params are used as-is.
140- * - tags_directive: (string) 'UNSPECIFIED', 'COPY', or 'REPLACE'.
141- * Defaults derived from `copy_props`. UNSPECIFIED means no tag work.
142- * COPY reads source tags via GetObjectTagging and writes to the
143- * destination via PutObjectTagging after CompleteMultipartUpload.
144- * REPLACE skips the read and writes caller-supplied `params['Tagging']`
145- * to the destination.
146- * - annotations_directive: (string) 'UNSPECIFIED', 'COPY', or 'EXCLUDE'.
147- * Defaults derived from `copy_props`. UNSPECIFIED and EXCLUDE both
148- * skip annotation work. COPY reads source annotations via
149- * ListObjectAnnotations and per-name GetObjectAnnotation, then writes
150- * them to the destination via per-name PutObjectAnnotation.
110+ * - metadata_directive: (string, default='COPY') 'COPY' or 'REPLACE'.
111+ * Caller-supplied `params['Metadata']` does NOT change the directive,
112+ * set this option explicitly to opt into REPLACE. When 'COPY', source
113+ * metadata fields (Metadata, CacheControl, ContentDisposition,
114+ * ContentEncoding, ContentLanguage, ContentType, Expires) are forwarded
115+ * and any matching caller-supplied fields are dropped. When 'REPLACE',
116+ * no source metadata is read and caller-supplied params are used as-is.
117+ * - tags_directive: (string, default='UNSPECIFIED') 'UNSPECIFIED', 'COPY',
118+ * or 'REPLACE'. UNSPECIFIED means no tag work. COPY reads source tags
119+ * via GetObjectTagging and writes to the destination via
120+ * PutObjectTagging after CompleteMultipartUpload. REPLACE skips the
121+ * read and writes caller-supplied `params['Tagging']` to the
122+ * destination.
123+ * - annotations_directive: (string, default='UNSPECIFIED') 'UNSPECIFIED',
124+ * 'COPY', or 'EXCLUDE'. UNSPECIFIED and EXCLUDE both skip annotation
125+ * work. COPY reads source annotations via ListObjectAnnotations and
126+ * per-name GetObjectAnnotation, then writes them to the destination
127+ * via per-name PutObjectAnnotation.
151128 * - source_metadata: (Aws\ResultInterface) The result of a HeadObject call
152129 * on the copy source. If not provided, the SDK makes a HeadObject request
153130 * to obtain the source object's size and metadata. Providing this avoids
@@ -849,23 +826,6 @@ private function putAnnotationWithRetries(array $baseParams): PromiseInterface
849826 });
850827 }
851828
852- /**
853- * @return string
854- * @throws \InvalidArgumentException
855- */
856- private function resolveCopyProps (): string
857- {
858- $ value = $ this ->config ['copy_props ' ] ?? self ::COPY_PROPS_METADATA_DIRECTIVE ;
859- if (!isset (self ::VALID_COPY_PROPS [$ value ])) {
860- throw new \InvalidArgumentException (
861- "Invalid copy_props value ' $ value'. Must be one of: "
862- . implode (', ' , array_keys (self ::VALID_COPY_PROPS )) . '. '
863- );
864- }
865-
866- return $ value ;
867- }
868-
869829 /**
870830 * @return string
871831 */
@@ -876,11 +836,6 @@ private function resolveMetadataDirective(): string
876836 return strtoupper ((string ) $ explicit );
877837 }
878838
879- // copy_props=none implies REPLACE.
880- if ($ this ->resolveCopyProps () === self ::COPY_PROPS_NONE ) {
881- return 'REPLACE ' ;
882- }
883-
884839 return 'COPY ' ;
885840 }
886841
@@ -891,22 +846,19 @@ private function resolveMetadataDirective(): string
891846 private function resolveTagsDirective (): string
892847 {
893848 $ explicit = $ this ->config ['tags_directive ' ] ?? null ;
894- if ($ explicit !== null ) {
895- $ value = strtoupper ((string ) $ explicit );
896- if (!isset (self ::VALID_TAGS_DIRECTIVES [$ value ])) {
897- throw new \InvalidArgumentException (
898- "Invalid tags_directive value ' $ value'. Must be one of: "
899- . implode (', ' , array_keys (self ::VALID_TAGS_DIRECTIVES )) . '. '
900- );
901- }
849+ if ($ explicit === null ) {
850+ return self ::TAGS_DIRECTIVE_UNSPECIFIED ;
851+ }
902852
903- return $ value ;
853+ $ value = strtoupper ((string ) $ explicit );
854+ if (!isset (self ::VALID_TAGS_DIRECTIVES [$ value ])) {
855+ throw new \InvalidArgumentException (
856+ "Invalid tags_directive value ' $ value'. Must be one of: "
857+ . implode (', ' , array_keys (self ::VALID_TAGS_DIRECTIVES )) . '. '
858+ );
904859 }
905860
906- return match ($ this ->resolveCopyProps ()) {
907- self ::COPY_PROPS_DEFAULT => self ::TAGS_DIRECTIVE_COPY ,
908- default => self ::TAGS_DIRECTIVE_UNSPECIFIED ,
909- };
861+ return $ value ;
910862 }
911863
912864 /**
@@ -916,23 +868,19 @@ private function resolveTagsDirective(): string
916868 private function resolveAnnotationsDirective (): string
917869 {
918870 $ explicit = $ this ->config ['annotations_directive ' ] ?? null ;
919- if ($ explicit !== null ) {
920- $ value = strtoupper ((string ) $ explicit );
921- if (!isset (self ::VALID_ANNOTATIONS_DIRECTIVES [$ value ])) {
922- throw new \InvalidArgumentException (
923- "Invalid annotations_directive value ' $ value'. Must be one of: "
924- . implode (', ' , array_keys (self ::VALID_ANNOTATIONS_DIRECTIVES )) . '. '
925- );
926- }
871+ if ($ explicit === null ) {
872+ return self ::ANNOTATIONS_DIRECTIVE_UNSPECIFIED ;
873+ }
927874
928- return $ value ;
875+ $ value = strtoupper ((string ) $ explicit );
876+ if (!isset (self ::VALID_ANNOTATIONS_DIRECTIVES [$ value ])) {
877+ throw new \InvalidArgumentException (
878+ "Invalid annotations_directive value ' $ value'. Must be one of: "
879+ . implode (', ' , array_keys (self ::VALID_ANNOTATIONS_DIRECTIVES )) . '. '
880+ );
929881 }
930882
931- return match ($ this ->resolveCopyProps ()) {
932- self ::COPY_PROPS_DEFAULT => self ::ANNOTATIONS_DIRECTIVE_COPY ,
933- self ::COPY_PROPS_NONE => self ::ANNOTATIONS_DIRECTIVE_EXCLUDE ,
934- default => self ::ANNOTATIONS_DIRECTIVE_UNSPECIFIED ,
935- };
883+ return $ value ;
936884 }
937885
938886 /**
0 commit comments