/// <summary>获取访问的Url地址 /// </summary> public string GetUrl(FileIdentifier fileIdentifier, DateTime?expires = null) { var fastDFSPatch = (FastDFSPatch)fileIdentifier.Patch; var rd = new Random(); var index = rd.Next(fastDFSPatch.Trackers.Count); var selectTracker = fastDFSPatch.Trackers[index]; return(UrlUtil.CombineUrl(selectTracker.Url, fastDFSPatch.Name, fileIdentifier.FileId)); //return $"{selectTracker.Url.TrimEnd('/')}/{fastDFSPatch.Name}/{fileIdentifier.FileId.TrimStart('/')}"; }
public void CombineUrl_Test(string expected, params string[] parameters) { var actual = UrlUtil.CombineUrl(parameters); Assert.Equal(expected, actual); }