Skip to content

Commit

Permalink
LDEV-4692 remove password from error message, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Sep 14, 2023
1 parent 4f73f6f commit 15bd7da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/java/src/org/lucee/extension/pdf/PDFStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ public PdfReader getPdfReader() throws PageException {
return unlockPdf(new PdfReader(PDFUtil.toBytes(resource)));
}
catch (IOException ioe) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().createApplicationException("can not load file " + password + " [" + resource + "]", ioe.getMessage());
throw CFMLEngineFactory.getInstance().getExceptionUtil().createApplicationException("Error opening pdf file [" + resource
+ "], error thrown [" + ioe.getMessage() + "]" );
}
}

Expand Down
3 changes: 3 additions & 0 deletions tests/LDEV4692.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" {
pdf action="protect" source="#testPdf#" destination="#testPdf#" newUserPassword="#variables.password#" overwrite="true";
pdf action="extractText" source="#testPdf#" name="local.extractedText" password="#variables.password#";
expect( extractedText ).toInclude( testCode );
expect(function(){
pdf action="extractText" source="#testPdf#" name="local.extractedText";
}).toThrow(); // no password

pdf action="removePassword" source="#testPdf#" destination="#testPdf#" password="#variables.password#" overwrite="true";
pdf action="extractText" source="#testPdf#" name="local.extractedText";
Expand Down

0 comments on commit 15bd7da

Please sign in to comment.