| 1454 | } |
| 1455 | |
| 1456 | bool IsDirectory(std::string_view key, const S3Model::HeadObjectResult& result) { |
| 1457 | // If it has a non-zero length, it's a regular file. We do this even if |
| 1458 | // the key has a trailing slash, as directory markers should never have |
| 1459 | // any data associated to them. |
| 1460 | if (result.GetContentLength() > 0) { |
| 1461 | return false; |
| 1462 | } |
| 1463 | // Otherwise, if it has a trailing slash, it's a directory |
| 1464 | if (internal::HasTrailingSlash(key)) { |
| 1465 | return true; |
| 1466 | } |
| 1467 | // Otherwise, if its content type starts with "application/x-directory", |
| 1468 | // it's a directory |
| 1469 | if (result.GetContentType().starts_with(kAwsDirectoryContentType)) { |
| 1470 | return true; |
| 1471 | } |
| 1472 | |
| 1473 | // Otherwise, it's a regular file. |
| 1474 | return false; |
| 1475 | } |
| 1476 | |
| 1477 | // A RandomAccessFile that reads from a S3 object |
| 1478 | class ObjectInputFile final : public io::RandomAccessFile { |
no test coverage detected