Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsbeautifier: move import #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

jsbeautifier: move import #50

wants to merge 1 commit into from

Conversation

Titotix
Copy link

@Titotix Titotix commented Feb 17, 2016

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.

None yet

2 participants