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