Fix ATTACH FROM s3_plain for wide part

Previously because of incorrect
MetadataStorageFromPlainObjectStorage::exists(), that used
S3ObjectStorage::exists() before, which works only for existing keys,
not some intermediate path.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-11-03 05:40:57 +01:00
parent 41884d3b88
commit 2cbc61df18

View File

@ -39,8 +39,11 @@ std::filesystem::path MetadataStorageFromPlainObjectStorage::getAbsolutePath(con
bool MetadataStorageFromPlainObjectStorage::exists(const std::string & path) const
{
auto object = StoredObject::create(*object_storage, getAbsolutePath(path));
return object_storage->exists(object);
RelativePathsWithSize children;
/// NOTE: exists() cannot be used here since it works only for existing
/// key, and does not work for some intermediate path.
object_storage->findAllFiles(getAbsolutePath(path), children, 1);
return !children.empty();
}
bool MetadataStorageFromPlainObjectStorage::isFile(const std::string & path) const