Ejemplo n.º 1
0
        /// <summary>
        /// 指定对象key获取访问对象的URL
        /// </summary>
        /// <param name="objectKey"></param>
        /// <returns></returns>
        public string GetObjectUrl(string objectKey)
        {
            var bucketUrl = BucketUri.ToString();

            if (String.IsNullOrEmpty(objectKey))
            {
                return(bucketUrl);
            }

            if (bucketUrl.EndsWith("/"))
            {
                return(bucketUrl + OssUtils.UrlEncodeKey(objectKey));
            }
            else
            {
                return(bucketUrl + "/" + OssUtils.UrlEncodeKey(objectKey));
            }
        }