Skip to content

Commit

Permalink
add cdmid to pdf filename to prevent overwriting index.pdf files
Browse files Browse the repository at this point in the history
  • Loading branch information
krwong committed Nov 20, 2024
1 parent 25833e3 commit 0115921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public String exportUnmapped() throws IOException {
String filePath;
// Pdf and image cpd objects are located in different places
if (CdmIndexService.ENTRY_TYPE_DOCUMENT_PDF.equals(entryTypeField)) {
filename = "index.pdf";
// add cdmid to filename to prevent overwriting
filename = origMapping.getCdmId() + "_index.pdf";
filePath = pdfDir.resolve(origMapping.getCdmId() + "/index.pdf").toString();
} else {
filename = fileInfo.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void withUnmappedPdfFilesTest() throws Exception {
var sourceFileService = testHelper.getSourceFileService();
var mappingInfo = sourceFileService.loadMappings();
var mapping1 = mappingInfo.getMappingByCdmId("17940");
assertEquals(exportedSourceFilesPath.resolve("index.pdf"), mapping1.getFirstSourcePath());
assertEquals(exportedSourceFilesPath.resolve("17940_index.pdf"), mapping1.getFirstSourcePath());
}

@Test
Expand Down

0 comments on commit 0115921

Please sign in to comment.