Skip to content

[Bug]: Error loading theme list when Portal has custom Portal HomeFolder #6263

@thienvc

Description

@thienvc

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When the Site directory is a custom directory Sites/MySite (not the default directory Portals/[portalid] )
When working with Themes, an error occurs at the CreateThumbnail constructor in ThemesController

if (string.IsNullOrEmpty(imageFileName) || imageFileName.StartsWith("thumbnail_"))
{
strImage = Globals.ApplicationPath + "/" + strImage.Substring(strImage.IndexOf("portals\\"));
strImage = strImage.Replace("\\", "/");
return strImage;
}

The current code strImage.Substring(strImage.IndexOf("portals\\") causes an error because "portals\\" does not exist in the path
Fix:
Replace the line strThumbnail = Globals.ApplicationPath + "/" + strThumbnail.Substring(strThumbnail.IndexOf("portals\\"));
with the line: strImage = strImage.Substring(Globals.ApplicationMapPath.Length);
strThumbnail = Globals.ApplicationPath + "/" + strThumbnail.Substring(strThumbnail.IndexOf("portals\\"));

Fix:
Replace the line strThumbnail = Globals.ApplicationPath + "/" + strThumbnail.Substring(strThumbnail.IndexOf("portals\\"));
by the line strThumbnail = strThumbnail.Substring(Globals.ApplicationMapPath.Length);

Steps to reproduce?

  1. Create a new Site, in the Site Directory section, enter a custom folder name, for example "Sites/MYSITE"
    image
    By default, the Site folder will be Portals/[PortalID], but I have a habit of changing this folder
  2. Copy any Theme set to the "Sites/MYSITE-System/Skins" folder
  3. Go to PersonalBar -> Themes and you will get an error
    Go to settings for any page and you will also get an error

Current Behavior

No response

Expected Behavior

No response

Relevant log output

No response

Anything else?

No response

Affected Versions

9.13.6 (latest release)

What browsers are you seeing the problem on?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions