Skip to content

jsbeautifier: move import#50

Open
Titotix wants to merge 1 commit into
jesparza:masterfrom
Titotix:dev
Open

jsbeautifier: move import#50
Titotix wants to merge 1 commit into
jesparza:masterfrom
Titotix:dev

Conversation

@Titotix

@Titotix Titotix commented Feb 17, 2016

Copy link
Copy Markdown

When jsbeautifier.unpacker failed to import, exception is catch by JSAnalysis module and handled transparently.

To reproduce the error :
- You are in peepdf repo
- Create reproduct_error.py at ../ with :

 from peepdf import *
 from peepdf.PDFCore import *

 pdfparser = PDFParser()
 ret, pdf = pdfparser.parse(<pdf_file_toanalyse>)
 print pdf.getJavascriptCode(None)

Expected output : a list of java script code (obviously, if your pdf contains some)
Actual output : Error: An error has occurred while parsing an indirect object!!
And with forceMode=True, output will be an empty array.

With this patch, the same script will raise ImportException. This is a lot easier to understand and debug.

When jsbeautifier.unpacker failed to import, exception is no more catch by JSAnalysis module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants