**Describe the situation**

The author implemented it but enabled only for DiskS3.
CC @excitoon 
{
    if (!exists(RESTORE_FILE_NAME))
        return;
    try
    {
        RestoreInformation information;
        information.source_bucket = bucket;
        information.source_path = remote_fs_root_path;
        readRestoreInformation(information);
        if (information.revision == 0)
            information.revision = LATEST_REVISION;
        if (!information.source_path.ends_with('/'))
            information.source_path += '/';
        if (information.source_bucket == bucket)
        {
            
            
            if (information.source_path == remote_fs_root_path && information.revision != LATEST_REVISION)
                throw Exception("Restoring to the same bucket and path is allowed if revision is latest (0)", ErrorCodes::BAD_ARGUMENTS);
            
            if (information.source_path != remote_fs_root_path && remote_fs_root_path.starts_with(information.source_path))
                throw Exception("Restoring to the same bucket is allowed only if source path is not a sub-path of configured path in S3 disk", ErrorCodes::BAD_ARGUMENTS);