AB4079 - Review fixes

This commit is contained in:
Bjarke Berg
2019-12-06 09:49:10 +01:00
parent 5c6dcc900e
commit 82bb1f00fc
15 changed files with 78 additions and 95 deletions

View File

@@ -1215,21 +1215,6 @@ namespace Umbraco.Core
public static string NullOrWhiteSpaceAsNull(this string text)
=> string.IsNullOrWhiteSpace(text) ? null : text;
/// <summary>
/// Ensures that a path has `~/` as prefix
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static string EnsurePathIsApplicationRootPrefixed(this string path)
{
if (path.StartsWith("~/"))
return path;
if (path.StartsWith("/") == false && path.StartsWith("\\") == false)
path = string.Format("/{0}", path);
if (path.StartsWith("~") == false)
path = string.Format("~{0}", path);
return path;
}
/// <summary>
/// Checks if a given path is a full path including drive letter