-
Notifications
You must be signed in to change notification settings - Fork 38
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
[GmailUtils.gs] Processing Certain Messages Consistently Causes A "Regular expression operation exceeded execution time limit." Exception To Be Thrown #1
Comments
Interesting... I'm not sure how to get around that one other than perhaps breaking the regex down into smaller expressions without the lookahead rules. But that feels like a hack. |
Well, considering this peace of code is running up against limits imposed server side I wouldn't be surprised if the solution ends up being some sort of kludge. In that spirit I tried rewriting that particular section of code to use regex.exec() instead of string.replace() hoping the run time/timing constraints would be different but it was no good. BTW, if you would like a message to test changes with just let me know what email address I should forward the offending message to and I'll pass it along. |
It appears that others have been running into this issue as well. I don't have time at the moment to find a solution, but I am putting this on my back log of tasks and I have collected several example emails from reporters. As always, if anyone else feels like giving it a go, I would be happy to accept pull requests too. |
@PaulWGraham @mikegreiling |
Hi @mikegreiling, I don't know how it works but would you be able to release omkar9999 's update as new version because I am getting same error and the latest version (4) of GmalUtils doesn't have his updates. Thank you UPDATE I did try to use new code updates by omkar9999 by copying them to a file in my project but it still fails to convert email to pdf. Can someone please find another solution? I will post the solution if I could find it. Thank you |
Processing certain messages consistently causes an "InternalError: Regular expression operation exceeded execution time limit." exception to be thrown. Specifically, when processing messages using the call messageToPdf(messages,{embedAvatar:false}) certain messages reliably cause the line of code below from the embedHtmlImages_ function to throw the exception.
The line of code throwing the exception:
// process all style attributes
html = html.replace(/(<[^>]+style=)(["'])((?:(?!\2)[^]|.))\2/gi, function(m, tag, q, style)
Note:
The actual emails in question are Kickstarter Project Updates. Not all Kickstarter Project Updates trigger the exception but one that does is Project Update #49: Double Fine's MASSIVE CHALICE by Double Fine and 2 Player Productions.
The text was updated successfully, but these errors were encountered: