DocSpace-client/common/ASC.Data.Backup.Core/Utils/FCKEditorPathUtility.cs

19 lines
679 B
C#
Raw Normal View History

namespace ASC.Data.Backup.Utils;
static class FCKEditorPathUtility
2020-05-20 15:14:44 +00:00
{
2022-02-10 12:29:49 +00:00
private static readonly Regex _regex = new Regex("(?<start>\\/data\\/(?>htmleditorfiles|fckcomments))(?<tenant>\\/0\\/|\\/[\\d]+\\/\\d\\d\\/\\d\\d\\/)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled);
2020-05-20 15:14:44 +00:00
public static string CorrectStoragePath(string content, int tenant)
{
if (string.IsNullOrWhiteSpace(content))
2020-05-20 15:14:44 +00:00
{
return content;
}
2022-02-09 18:33:50 +00:00
var tenantPath = "/" + TenantPath.CreatePath(tenant.ToString()) + "/";
2022-02-09 18:33:50 +00:00
2022-02-10 12:29:49 +00:00
return _regex.Replace(content, (m) => m.Success ? m.Groups["start"] + tenantPath : string.Empty);
2020-05-20 15:14:44 +00:00
}
}