feat(#68): fall back to filename as title when createDocument gets no title
When a document is created without an explicit title (null or blank), the service now derives the title from the uploaded filename using the same titleFromFilename() logic already used by storeDocument — stripping the extension for plain names and formatting structured names as "Firstname Lastname (DD.MM.YYYY)". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -108,9 +108,13 @@ public class DocumentService {
|
||||
|| (dto.getReceiverIds() != null && !dto.getReceiverIds().isEmpty());
|
||||
}
|
||||
|
||||
String titleToUse = (dto.getTitle() != null && !dto.getTitle().isBlank())
|
||||
? dto.getTitle()
|
||||
: titleFromFilename(filename);
|
||||
|
||||
Document doc = Document.builder()
|
||||
.originalFilename(filename)
|
||||
.title(dto.getTitle())
|
||||
.title(titleToUse)
|
||||
.documentDate(dto.getDocumentDate())
|
||||
.location(dto.getLocation())
|
||||
.documentLocation(dto.getDocumentLocation())
|
||||
|
||||
Reference in New Issue
Block a user