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) {
// Some providers, e.g., Swift, do not provide container
// creation date. Emit a bogus one to satisfy clients like
// s3cmd which require one.
creationDate = new Date(0);
}
xml.writeStartElement("CreationDate"); xml.writeStartElement("CreationDate");
xml.writeCharacters(blobStore.getContext().utils().date() xml.writeCharacters(blobStore.getContext().utils().date()
.iso8601DateFormat(creationDate).trim()); .iso8601DateFormat(creationDate).trim());
xml.writeEndElement(); xml.writeEndElement();
}
xml.writeEndElement(); xml.writeEndElement();
} }
xml.writeEndElement(); xml.writeEndElement();