MCPcopy Create free account
hub / github.com/apache/arrow / SetMetadataInRequest

Method SetMetadataInRequest

cpp/src/arrow/filesystem/s3fs.cc:1620–1644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618
1619 template <typename ObjectRequest>
1620 Status SetMetadataInRequest(ObjectRequest* request) {
1621 std::shared_ptr<const KeyValueMetadata> metadata;
1622
1623 if (metadata_ && metadata_->size() != 0) {
1624 metadata = metadata_;
1625 } else if (default_metadata_ && default_metadata_->size() != 0) {
1626 metadata = default_metadata_;
1627 }
1628
1629 bool is_content_type_set{false};
1630 if (metadata) {
1631 RETURN_NOT_OK(SetObjectMetadata(metadata, request));
1632
1633 is_content_type_set = metadata->Contains("Content-Type");
1634 }
1635
1636 if (!is_content_type_set) {
1637 // If we do not set anything then the SDK will default to application/xml
1638 // which confuses some tools (https://github.com/apache/arrow/issues/11934)
1639 // So we instead default to application/octet-stream which is less misleading
1640 request->SetContentType("application/octet-stream");
1641 }
1642
1643 return Status::OK();
1644 }
1645
1646 std::shared_ptr<ObjectOutputStream> Self() {
1647 return std::dynamic_pointer_cast<ObjectOutputStream>(shared_from_this());

Callers

nothing calls this directly

Calls 4

SetObjectMetadataFunction · 0.85
OKFunction · 0.50
sizeMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected