Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing fails at Publishing Mappings TBB because of missing null/empty string check in codebase #11

Open
dmandava opened this issue Mar 19, 2018 · 0 comments
Labels

Comments

@dmandava
Copy link

dmandava commented Mar 19, 2018

https://github.com/sdl/dxa-content-management/blob/1959468d0175d6b9ad843e8969346c17b58f5583/Sdl.Web.Tridion.Templates/Templates/PublishMappings.cs#L152

DXA 1.6

Problem
ExtractTypeOfAppData method returns empty string if the schema does not have AppData for ApplicationId 'TypeOf'. With existing code the variable typeOf will be "tri:Content,".
In BuildSchemaSemanticsJson method with "input = tri:Content," results in an error.

This results in publishing failure of Publish Settings page.

Existing code
PublishingMappings.cs Line 150
ApplicationData appData = schema.LoadApplicationData(TypeOfAppDataId);
if (appData != null)
{
typeOf += "," + ExtractTypeOfAppData(appData);
}

Solution
We have to check to see if ExtractTypeOfAppData method is not empty, then only add ',' separated values of typeOf values.

            if (appData != null)
            {
                string typeOfAppData = ExtractTypeOfAppData(appData);
                if (!string.IsNullOrEmpty(typeOfAppData)) //new line to be added to avoid 
                {
                    typeOf += "," + ExtractTypeOfAppData(appData);
                }                    
            }
@rpannekoek rpannekoek added the bug label Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants