DocSpace-buildtools/common/ASC.Common/Web/VirtualPathUtility.cs

20 lines
430 B
C#
Raw Normal View History

namespace ASC.Common.Web;
public class VirtualPathUtility
{
public static string ToAbsolute(string virtualPath)
{
if (string.IsNullOrEmpty(virtualPath))
2022-02-08 11:07:28 +00:00
{
return virtualPath;
2022-02-08 11:07:28 +00:00
}
2019-07-29 08:01:03 +00:00
if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
2022-02-08 11:07:28 +00:00
{
return virtualPath;
2022-02-08 11:07:28 +00:00
}
2019-07-29 08:01:03 +00:00
return "/" + virtualPath.TrimStart('~', '/');
}
}