Skip to content

Conversation

@bdukes
Copy link
Contributor

@bdukes bdukes commented Jan 6, 2026

Fixes #6885

@bdukes bdukes added this to the 10.2.2 milestone Jan 6, 2026
Copy link
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@mnouraei
Copy link
Contributor

mnouraei commented Jan 7, 2026

Problem

The current RTL resource detection logic incorrectly combines a virtual path
(resource.FilePath, starting with ~) with a physical path (ApplicationMapPath)
when checking for file existence.

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:

C:\DnnTest\dnn-10.2.1-v1~/Resources/Shared/stylesheets/dnndefault/10.0.0/default.rtl.css

As a result, File.Exists(...) always returns false, even when the RTL file
actually exists.

var ext = Path.GetExtension(resource.FilePath);
var rtlFilePath = Path.ChangeExtension(resource.FilePath, ".rtl" + ext);

if (!File.Exists(this.appStatus.ApplicationMapPath + rtlFilePath))
{
    return resource;
}

Issue:
resource.FilePath is a virtual path, but File.Exists requires a physical path.

Proposed Fix

The fix uses resource.ResolvedPath to correctly check the physical existence
of the RTL file, and only then updates the resource paths.

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
Prevents invalid physical paths caused by mixing virtual and physical paths
Aligns with DNN’s internal resource resolution mechanism
Ensures RTL stylesheets are correctly detected and loaded

@bdukes
Copy link
Contributor Author

bdukes commented Jan 7, 2026

I've pushed an update which uses the ResolvePath instead of the FilePath, I believe that should resolve the issue you raised. Thanks for taking a look and giving feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Resource files (e.g. *.rtl.css) are not loaded after DNN 10.2.* (CDF changes)

3 participants