| 1392 | } |
| 1393 | |
| 1394 | bool IsDirectory(std::string_view key, const S3Model::HeadObjectResult& result) { |
| 1395 | // If it has a non-zero length, it's a regular file. We do this even if |
| 1396 | // the key has a trailing slash, as directory markers should never have |
| 1397 | // any data associated to them. |
| 1398 | if (result.GetContentLength() > 0) { |
| 1399 | return false; |
| 1400 | } |
| 1401 | // Otherwise, if it has a trailing slash, it's a directory |
| 1402 | if (internal::HasTrailingSlash(key)) { |
| 1403 | return true; |
| 1404 | } |
| 1405 | // Otherwise, if its content type starts with "application/x-directory", |
| 1406 | // it's a directory |
| 1407 | if (result.GetContentType().starts_with(kAwsDirectoryContentType)) { |
| 1408 | return true; |
| 1409 | } |
| 1410 | |
| 1411 | // Otherwise, it's a regular file. |
| 1412 | return false; |
| 1413 | } |
| 1414 | |
| 1415 | // A RandomAccessFile that reads from a S3 object |
| 1416 | class ObjectInputFile final : public io::RandomAccessFile { |
no test coverage detected