{"action":"closed","issue":{"url":"https://api.github.com/repos/QQuick/Opy/issues/12","repository_url":"https://api.github.com/repos/QQuick/Opy","labels_url":"https://api.github.com/repos/QQuick/Opy/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/QQuick/Opy/issues/12/comments","events_url":"https://api.github.com/repos/QQuick/Opy/issues/12/events","html_url":"https://github.com/QQuick/Opy/issues/12","id":197750314,"number":12,"title":"Opy failing to obfuscate code with strings that contain the # character (with obfuscate_strings = False)","user":{"login":"andimarafioti","id":9143109,"avatar_url":"https://avatars.githubusercontent.com/u/9143109?v=3","gravatar_id":"","url":"https://api.github.com/users/andimarafioti","html_url":"https://github.com/andimarafioti","followers_url":"https://api.github.com/users/andimarafioti/followers","following_url":"https://api.github.com/users/andimarafioti/following{/other_user}","gists_url":"https://api.github.com/users/andimarafioti/gists{/gist_id}","starred_url":"https://api.github.com/users/andimarafioti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andimarafioti/subscriptions","organizations_url":"https://api.github.com/users/andimarafioti/orgs","repos_url":"https://api.github.com/users/andimarafioti/repos","events_url":"https://api.github.com/users/andimarafioti/events{/privacy}","received_events_url":"https://api.github.com/users/andimarafioti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-27T19:56:34Z","updated_at":"2016-12-27T19:59:26Z","closed_at":"2016-12-27T19:59:26Z","body":"I'm getting errors when I obfuscate strings that contain the # character. \r\nThis error happens both for single quoted strings and triple quoted strings:\r\n\r\ntype A: single quoted\r\n`DISCONNECTED_MESSAGE = u\"Estás utilizando esTTela sin conexión a la red. Volviendo a intentar conectar en {} <a href='LINK'><font color=#ffffff>Reintentar</font></a>\"\r\n`\r\nBecomes: \r\n`l1ll11lllll1l1_opy_ = u\"Estás utilizando esTTela sin conexión a la red. Volviendo a intentar conectar en {} <a href='LINK'><font color= \r\n`\r\nNote that the quotes are not closed at the end of the string, therefore the obfuscated code fails with \"SyntaxError: EOL while scanning string literal\"\r\n\r\ntype B: triple quoted \r\n`message_link = \"\"\"<a href='LINK'><font color=#ffffff>click acá</font></a>\"\"\"\r\n`\r\nBecomes: \r\n`message_link = \"\"\"<a href='LINK'><font color=\r\n`\r\nThis case is actually worse because it comments the rest of the code (though it is obfuscated).\r\n\r\nI debugged opy trying to fix this, but I am miles away from the author in regEx knowledge. The issue arises in line 431 of opy.py:\r\n\r\n`normalContent = commentRegEx.sub (getCommentPlaceholderAndRegister, normalContent)\r\n`\r\nUp until that point, the comment is correctly loaded. There it is sliced.\r\n\r\nI think the regEx that needs to be fixed is the one found in line 229 of opy.py:\r\n\r\n`commentRegEx = re.compile (r'{0}{1}{2}.*?$'.format (\r\n\t\tr\"(?<!')\",\r\n\t\tr'(?<!\")',\r\n\t\tr'#'\r\n\t), re.MULTILINE)\r\n`"}}
{"actor":{"display_login":"andimarafioti"}}