Emit bogus CreationDate when not present

pull/36/head
Andrew Gaul 2015-01-15 18:22:54 -08:00
rodzic 869d47a5e1
commit 05b63365bf
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -444,12 +444,16 @@ final class S3ProxyHandler extends AbstractHandler {
xml.writeEndElement(); xml.writeEndElement();
Date creationDate = metadata.getCreationDate(); Date creationDate = metadata.getCreationDate();
if (creationDate != null) { if (creationDate == null) {
xml.writeStartElement("CreationDate"); // Some providers, e.g., Swift, do not provide container
xml.writeCharacters(blobStore.getContext().utils().date() // creation date. Emit a bogus one to satisfy clients like
.iso8601DateFormat(creationDate).trim()); // s3cmd which require one.
xml.writeEndElement(); creationDate = new Date(0);
} }
xml.writeStartElement("CreationDate");
xml.writeCharacters(blobStore.getContext().utils().date()
.iso8601DateFormat(creationDate).trim());
xml.writeEndElement();
xml.writeEndElement(); xml.writeEndElement();
} }
xml.writeEndElement(); xml.writeEndElement();