kopia lustrzana https://github.com/gaul/s3proxy
Set content bits only when provider supports them
Previously the AWS SDK choked on these null values.pull/210/head
rodzic
d3023e1695
commit
802b8510cf
|
@ -916,30 +916,26 @@ public final class AwsSdkTest {
|
||||||
public void testSinglepartUpload() throws Exception {
|
public void testSinglepartUpload() throws Exception {
|
||||||
String blobName = "singlepart-upload";
|
String blobName = "singlepart-upload";
|
||||||
String cacheControl = "max-age=3600";
|
String cacheControl = "max-age=3600";
|
||||||
if (Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
|
||||||
cacheControl = null;
|
|
||||||
}
|
|
||||||
String contentDisposition = "attachment; filename=new.jpg";
|
String contentDisposition = "attachment; filename=new.jpg";
|
||||||
if (Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
|
||||||
contentDisposition = null;
|
|
||||||
}
|
|
||||||
String contentEncoding = "gzip";
|
String contentEncoding = "gzip";
|
||||||
if (Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
|
||||||
contentEncoding = null;
|
|
||||||
}
|
|
||||||
String contentLanguage = "fr";
|
String contentLanguage = "fr";
|
||||||
if (Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
|
||||||
contentLanguage = null;
|
|
||||||
}
|
|
||||||
String contentType = "audio/mp4";
|
String contentType = "audio/mp4";
|
||||||
Map<String, String> userMetadata = ImmutableMap.of(
|
Map<String, String> userMetadata = ImmutableMap.of(
|
||||||
"key1", "value1",
|
"key1", "value1",
|
||||||
"key2", "value2");
|
"key2", "value2");
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
if (!Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
||||||
metadata.setCacheControl(cacheControl);
|
metadata.setCacheControl(cacheControl);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
metadata.setContentDisposition(contentDisposition);
|
metadata.setContentDisposition(contentDisposition);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
metadata.setContentEncoding(contentEncoding);
|
metadata.setContentEncoding(contentEncoding);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
||||||
metadata.setContentLanguage(contentLanguage);
|
metadata.setContentLanguage(contentLanguage);
|
||||||
|
}
|
||||||
metadata.setContentLength(BYTE_SOURCE.size());
|
metadata.setContentLength(BYTE_SOURCE.size());
|
||||||
metadata.setContentType(contentType);
|
metadata.setContentType(contentType);
|
||||||
// TODO: expires
|
// TODO: expires
|
||||||
|
@ -982,30 +978,26 @@ public final class AwsSdkTest {
|
||||||
public void testMultipartUpload() throws Exception {
|
public void testMultipartUpload() throws Exception {
|
||||||
String blobName = "multipart-upload";
|
String blobName = "multipart-upload";
|
||||||
String cacheControl = "max-age=3600";
|
String cacheControl = "max-age=3600";
|
||||||
if (Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
|
||||||
cacheControl = null;
|
|
||||||
}
|
|
||||||
String contentDisposition = "attachment; filename=new.jpg";
|
String contentDisposition = "attachment; filename=new.jpg";
|
||||||
if (Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
|
||||||
contentDisposition = null;
|
|
||||||
}
|
|
||||||
String contentEncoding = "gzip";
|
String contentEncoding = "gzip";
|
||||||
if (Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
|
||||||
contentEncoding = null;
|
|
||||||
}
|
|
||||||
String contentLanguage = "fr";
|
String contentLanguage = "fr";
|
||||||
if (Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
|
||||||
contentLanguage = null;
|
|
||||||
}
|
|
||||||
String contentType = "audio/mp4";
|
String contentType = "audio/mp4";
|
||||||
Map<String, String> userMetadata = ImmutableMap.of(
|
Map<String, String> userMetadata = ImmutableMap.of(
|
||||||
"key1", "value1",
|
"key1", "value1",
|
||||||
"key2", "value2");
|
"key2", "value2");
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
if (!Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
||||||
metadata.setCacheControl(cacheControl);
|
metadata.setCacheControl(cacheControl);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
metadata.setContentDisposition(contentDisposition);
|
metadata.setContentDisposition(contentDisposition);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
metadata.setContentEncoding(contentEncoding);
|
metadata.setContentEncoding(contentEncoding);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
||||||
metadata.setContentLanguage(contentLanguage);
|
metadata.setContentLanguage(contentLanguage);
|
||||||
|
}
|
||||||
metadata.setContentType(contentType);
|
metadata.setContentType(contentType);
|
||||||
// TODO: expires
|
// TODO: expires
|
||||||
metadata.setUserMetadata(userMetadata);
|
metadata.setUserMetadata(userMetadata);
|
||||||
|
@ -1140,20 +1132,25 @@ public final class AwsSdkTest {
|
||||||
String cacheControl = "max-age=3600";
|
String cacheControl = "max-age=3600";
|
||||||
String contentDisposition = "attachment; filename=old.jpg";
|
String contentDisposition = "attachment; filename=old.jpg";
|
||||||
String contentEncoding = "gzip";
|
String contentEncoding = "gzip";
|
||||||
if (Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
|
||||||
contentEncoding = null;
|
|
||||||
}
|
|
||||||
String contentLanguage = "en";
|
String contentLanguage = "en";
|
||||||
String contentType = "audio/ogg";
|
String contentType = "audio/ogg";
|
||||||
Map<String, String> userMetadata = ImmutableMap.of(
|
Map<String, String> userMetadata = ImmutableMap.of(
|
||||||
"key1", "value1",
|
"key1", "value1",
|
||||||
"key2", "value2");
|
"key2", "value2");
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
if (!Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
||||||
metadata.setCacheControl(cacheControl);
|
metadata.setCacheControl(cacheControl);
|
||||||
|
}
|
||||||
metadata.setContentLength(BYTE_SOURCE.size());
|
metadata.setContentLength(BYTE_SOURCE.size());
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
metadata.setContentDisposition(contentDisposition);
|
metadata.setContentDisposition(contentDisposition);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
metadata.setContentEncoding(contentEncoding);
|
metadata.setContentEncoding(contentEncoding);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
||||||
metadata.setContentLanguage(contentLanguage);
|
metadata.setContentLanguage(contentLanguage);
|
||||||
|
}
|
||||||
metadata.setContentType(contentType);
|
metadata.setContentType(contentType);
|
||||||
// TODO: expires
|
// TODO: expires
|
||||||
metadata.setUserMetadata(userMetadata);
|
metadata.setUserMetadata(userMetadata);
|
||||||
|
@ -1176,8 +1173,10 @@ public final class AwsSdkTest {
|
||||||
assertThat(contentMetadata.getCacheControl()).isEqualTo(
|
assertThat(contentMetadata.getCacheControl()).isEqualTo(
|
||||||
cacheControl);
|
cacheControl);
|
||||||
}
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
assertThat(contentMetadata.getContentDisposition()).isEqualTo(
|
assertThat(contentMetadata.getContentDisposition()).isEqualTo(
|
||||||
contentDisposition);
|
contentDisposition);
|
||||||
|
}
|
||||||
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
assertThat(contentMetadata.getContentEncoding()).isEqualTo(
|
assertThat(contentMetadata.getContentEncoding()).isEqualTo(
|
||||||
contentEncoding);
|
contentEncoding);
|
||||||
|
@ -1199,10 +1198,18 @@ public final class AwsSdkTest {
|
||||||
String toName = "to-name";
|
String toName = "to-name";
|
||||||
ObjectMetadata metadata = new ObjectMetadata();
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
metadata.setContentLength(BYTE_SOURCE.size());
|
metadata.setContentLength(BYTE_SOURCE.size());
|
||||||
|
if (!Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
||||||
metadata.setCacheControl("max-age=3600");
|
metadata.setCacheControl("max-age=3600");
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
metadata.setContentDisposition("attachment; filename=old.jpg");
|
metadata.setContentDisposition("attachment; filename=old.jpg");
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
metadata.setContentEncoding("compress");
|
metadata.setContentEncoding("compress");
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
||||||
metadata.setContentLanguage("en");
|
metadata.setContentLanguage("en");
|
||||||
|
}
|
||||||
metadata.setContentType("audio/ogg");
|
metadata.setContentType("audio/ogg");
|
||||||
// TODO: expires
|
// TODO: expires
|
||||||
metadata.setUserMetadata(ImmutableMap.of(
|
metadata.setUserMetadata(ImmutableMap.of(
|
||||||
|
@ -1214,16 +1221,21 @@ public final class AwsSdkTest {
|
||||||
String cacheControl = "max-age=1800";
|
String cacheControl = "max-age=1800";
|
||||||
String contentDisposition = "attachment; filename=new.jpg";
|
String contentDisposition = "attachment; filename=new.jpg";
|
||||||
String contentEncoding = "gzip";
|
String contentEncoding = "gzip";
|
||||||
if (Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
|
||||||
contentEncoding = null;
|
|
||||||
}
|
|
||||||
String contentLanguage = "fr";
|
String contentLanguage = "fr";
|
||||||
String contentType = "audio/mp4";
|
String contentType = "audio/mp4";
|
||||||
ObjectMetadata contentMetadata = new ObjectMetadata();
|
ObjectMetadata contentMetadata = new ObjectMetadata();
|
||||||
|
if (!Quirks.NO_CACHE_CONTROL_SUPPORT.contains(blobStoreType)) {
|
||||||
contentMetadata.setCacheControl(cacheControl);
|
contentMetadata.setCacheControl(cacheControl);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
contentMetadata.setContentDisposition(contentDisposition);
|
contentMetadata.setContentDisposition(contentDisposition);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
contentMetadata.setContentEncoding(contentEncoding);
|
contentMetadata.setContentEncoding(contentEncoding);
|
||||||
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_LANGUAGE.contains(blobStoreType)) {
|
||||||
contentMetadata.setContentLanguage(contentLanguage);
|
contentMetadata.setContentLanguage(contentLanguage);
|
||||||
|
}
|
||||||
contentMetadata.setContentType(contentType);
|
contentMetadata.setContentType(contentType);
|
||||||
// TODO: expires
|
// TODO: expires
|
||||||
Map<String, String> userMetadata = ImmutableMap.of(
|
Map<String, String> userMetadata = ImmutableMap.of(
|
||||||
|
@ -1246,8 +1258,10 @@ public final class AwsSdkTest {
|
||||||
assertThat(contentMetadata.getCacheControl()).isEqualTo(
|
assertThat(contentMetadata.getCacheControl()).isEqualTo(
|
||||||
cacheControl);
|
cacheControl);
|
||||||
}
|
}
|
||||||
|
if (!Quirks.NO_CONTENT_DISPOSITION.contains(blobStoreType)) {
|
||||||
assertThat(toContentMetadata.getContentDisposition()).isEqualTo(
|
assertThat(toContentMetadata.getContentDisposition()).isEqualTo(
|
||||||
contentDisposition);
|
contentDisposition);
|
||||||
|
}
|
||||||
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
if (!Quirks.NO_CONTENT_ENCODING.contains(blobStoreType)) {
|
||||||
assertThat(toContentMetadata.getContentEncoding()).isEqualTo(
|
assertThat(toContentMetadata.getContentEncoding()).isEqualTo(
|
||||||
contentEncoding);
|
contentEncoding);
|
||||||
|
|
Ładowanie…
Reference in New Issue