core icon indicating copy to clipboard operation
core copied to clipboard

Content API/GraphQL: Title Property Inconsistency on Assets

Open rjvelazco opened this issue 5 months ago • 1 comments

Parent Issue

N/A

Problem Statement

There is an inconsistency between the title field displayed in the dotCMS admin interface and the title retrieved via the content API and GraphQL query. The title is overwritten with the file/asset name.

Steps to Reproduce

  1. Create Contenttype

    • Create a new contenttype called Test.
    • Add a text field called title.
    • Add a binary field.
  2. Create Contentlet

    • Create a new Test contentlet.
    • Add a title value.
    • Upload an asset (image or video).
    • Check the response of the Content API/GraphQL.

Error: The title field will be overwritten with the file/asset name in the Content API/GraphQL response

Acceptance Criteria

The title property should not be overwritten with the file/asset name.

dotCMS Version

master/trunk

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

More Details

This video contentlet has a title field. You can see there is a title field with this value: dotCMS Intro Animation Video. However, if you check the content API, the title is dotcms-v2.mp4.

The same happens if you run this GraphQL query:

query ContentAPI {
  search(query: "+contentType:Video +identifier:c7e0a6457746152fc2fc076ee9f6737e") {
    title
  }
}

However, in Velocity, we are respecting the real title:

<!-- This will print dotCMS Intro Animation Video -->
<span>${contentlet.get(0).title}</span> 

Importance

It's important to respect the real title because we are telling the user that the title is the file/asset name, when it's not. The Lucene Query doesn't work with the title that Content API or GraphQL returns:

"+contentType:Video +Video.title:${contentAPITitle}" // Doesn't work
"+contentType:Video +Video.title:${realTitle}" // Works

rjvelazco avatar Sep 24 '24 15:09 rjvelazco