File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
s3/src/main/java/ch/cyberduck/core/s3 Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2525import org .jets3t .service .model .StorageObject ;
2626
2727import java .util .Date ;
28+ import java .util .HashMap ;
2829import java .util .Map ;
2930
3031import com .google .common .collect .Maps ;
@@ -77,7 +78,7 @@ public String getDescription() {
7778 });
7879 }
7980 }
80- final Map <String , String > metadata = Maps . transformValues (object . getModifiableMetadata (), Object :: toString );
81+ final Map <String , String > metadata = metadata (object );
8182 if (!metadata .isEmpty ()) {
8283 attributes .setMetadata (metadata );
8384 }
@@ -93,4 +94,17 @@ public String getDescription() {
9394 }
9495 return attributes ;
9596 }
97+
98+ /**
99+ * @return Pruned metadata with user editable headers only
100+ */
101+ public static Map <String , String > metadata (final StorageObject object ) {
102+ final Map <String , String > metadata = new HashMap <>(Maps .transformValues (object .getModifiableMetadata (), Object ::toString ));
103+ metadata .keySet ().removeIf (header -> StringUtils .equalsIgnoreCase (header , "storage-class" ));
104+ metadata .keySet ().removeIf (header -> StringUtils .equalsIgnoreCase (header , "server-side-encryption" ));
105+ metadata .keySet ().removeIf (header -> StringUtils .equalsIgnoreCase (header , "expiration" ));
106+ metadata .keySet ().removeIf (header -> StringUtils .equalsIgnoreCase (header , "checksum-sha256" ));
107+ metadata .keySet ().removeIf (header -> StringUtils .equalsIgnoreCase (header , "version-id" ));
108+ return metadata ;
109+ }
96110}
You can’t perform that action at this time.
0 commit comments