public async Task IsObjectExistAsync()

in src/AlibabaCloud.OSS.V2/Client.Extensions.cs [21:57]


        public async Task<bool> IsObjectExistAsync(
            string bucket,
            string key,
            string? versionId = null,
            CancellationToken cancellationToken = default
        )
        {
            try
            {
                await GetObjectMetaAsync(
                    new()
                    {
                        Bucket = bucket,
                        Key = key,
                        VersionId = versionId
                    },
                    null,
                    cancellationToken
                );

                return true;
            }
            catch (OperationException e)
            {
                if (e.InnerException is ServiceException se)
                {
                    if (string.Equals(se.ErrorCode, "NoSuchKey"))
                        return false;

                    if (se.StatusCode == 404 &&
                        string.Equals(se.ErrorCode, "BadErrorResponse"))
                        return false;
                }

                throw;
            }
        }