Skip to content

Commit 9d0aa9f

Browse files
authored
Merge pull request #351 from cap-java/fileNameIssueInCopyafterRename
Fix for incorrect filename if copying attachments after renaming the source attachment
2 parents ae52054 + c406695 commit 9d0aa9f

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

sdm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@
529529
<plugin>
530530
<groupId>org.jacoco</groupId>
531531
<artifactId>jacoco-maven-plugin</artifactId>
532-
<version>0.8.12</version>
532+
<version>0.8.14</version>
533533
<configuration>
534534
<excludes>
535535
<exclude>

sdm/src/main/java/com/sap/cds/sdm/service/SDMServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ public List<String> copyAttachment(
687687

688688
JSONObject jsonObject = new JSONObject(responseBody);
689689
JSONObject props = jsonObject.getJSONObject("succinctProperties");
690-
String fileName = props.optString("cmis:contentStreamFileName");
690+
String fileName = props.optString("cmis:name");
691691
String mimeType = props.optString("cmis:contentStreamMimeType");
692692
String objectId = props.optString("cmis:objectId");
693693
return List.of(fileName, mimeType, objectId);

sdm/src/main/java/com/sap/cds/sdm/service/handler/SDMCustomServiceHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ private void createDraftEntries(CreateDraftEntriesRequest request) {
231231

232232
String fileName = attachmentMetadata.get(0);
233233
String mimeType = attachmentMetadata.get(1);
234-
if (mimeType.equalsIgnoreCase("application/internet-shortcut")) {
235-
int dotIndex = fileName.lastIndexOf('.');
236-
fileName = fileName.substring(0, dotIndex);
237-
}
238234
String newObjectId = attachmentMetadata.get(2);
239235

240236
updatedFields.put("objectId", newObjectId);

sdm/src/test/java/unit/com/sap/cds/sdm/service/SDMServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ public void testCopyAttachment_Success() throws Exception {
14981498
// Prepare mock response JSON
14991499
String responseBody =
15001500
"{\"succinctProperties\":{"
1501-
+ "\"cmis:contentStreamFileName\":\"file1.pdf\","
1501+
+ "\"cmis:name\":\"file1.pdf\","
15021502
+ "\"cmis:contentStreamMimeType\":\"application/pdf\","
15031503
+ "\"cmis:objectId\":\"obj123\"}}";
15041504

0 commit comments

Comments
 (0)