Return filename without path in search API
Problem to solve
The search API returns the full path of found blobs in the filename
response field.
For 12.5, !18470 (merged) renamed this field to path
to be consistent with the Elasticsearch index (gitlab-elasticsearch-indexer!44 (merged)), but also kept returning the full path in filename
to avoid breaking backwards-compatibility with API consumers.
At some point in the future, we can change filename
to return only the filename without the leading directory path.
Intended users
API consumers of the search API.
Further details
Proposal
- Change
API::Entities::Blob
to return only the filename infilename
, without the leading directory path - Since these blobs can come from either ES or Gitaly searches, it's probably easiest to implement the path-stripping again in
Gitlab::Search::FoundBlob
, even though we already have the basename available in the ES document.
Permissions and Security
Documentation
This breaking API change should be communicated.