Add back RTL resource handling#6888
Conversation
ProblemThe current RTL resource detection logic incorrectly combines a virtual path Example values: resource.FilePath = "~/Resources/Shared/stylesheets/dnndefault/10.0.0/default.css";
this.appStatus.ApplicationMapPath = "C:\\DnnTest\\dnn-10.2.1-v1";This produces an invalid physical path: As a result, File.Exists(...) always returns false, even when the RTL file var ext = Path.GetExtension(resource.FilePath);
var rtlFilePath = Path.ChangeExtension(resource.FilePath, ".rtl" + ext);
if (!File.Exists(this.appStatus.ApplicationMapPath + rtlFilePath))
{
return resource;
}Issue: Proposed Fix The fix uses resource.ResolvedPath to correctly check the physical existence var ext = Path.GetExtension(resource.FilePath);
// resource.FilePath is a virtual path (~),
// so we must use ResolvedPath to check physical file existence
var rtlResolvedPath = Path.ChangeExtension(resource.ResolvedPath, ".rtl" + ext);
var relativePath = rtlResolvedPath
.TrimStart('~')
.TrimStart(Path.DirectorySeparatorChar)
.Replace("/", "\\");
if (!File.Exists($"{this.appStatus.ApplicationMapPath}\\{relativePath}"))
{
return resource;
}
// Update virtual and resolved paths once RTL file is confirmed
var rtlFilePath = Path.ChangeExtension(resource.FilePath, ".rtl" + ext);
resource.FilePath = rtlFilePath;
resource.ResolvedPath = this.ResolvePath(rtlFilePath, resource.PathNameAlias);
Why This Fix ResolvedPath already represents the physical file location in DNN |
|
I've pushed an update which uses the |
Fixes #6885