SolbiatiAlessandro / lessand.ro

public repo for my personal website
http://lessand.ro
0 stars 0 forks source link

looks like there is some problem when inserting special chars inside a new post #1

Closed SolbiatiAlessandro closed 5 years ago

SolbiatiAlessandro commented 5 years ago

2019-02-20T02:34:09.129486+00:00 app[web.1]: [2019-02-20 02:34:09,127] ERROR in app: Exception on /create [POST] 2019-02-20T02:34:09.129528+00:00 app[web.1]: Traceback (most recent call last): 2019-02-20T02:34:09.129530+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app 2019-02-20T02:34:09.129532+00:00 app[web.1]: response = self.full_dispatch_request() 2019-02-20T02:34:09.129534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request 2019-02-20T02:34:09.129536+00:00 app[web.1]: rv = self.handle_user_exception(e) 2019-02-20T02:34:09.129538+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception 2019-02-20T02:34:09.129540+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2019-02-20T02:34:09.129542+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise 2019-02-20T02:34:09.129544+00:00 app[web.1]: raise value 2019-02-20T02:34:09.129546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request 2019-02-20T02:34:09.129548+00:00 app[web.1]: rv = self.dispatch_request() 2019-02-20T02:34:09.129549+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request 2019-02-20T02:34:09.129551+00:00 app[web.1]: return self.view_functionsrule.endpoint 2019-02-20T02:34:09.129553+00:00 app[web.1]: File "/app/flaskr/auth.py", line 102, in wrapped_view 2019-02-20T02:34:09.129555+00:00 app[web.1]: return view(**kwargs) 2019-02-20T02:34:09.129556+00:00 app[web.1]: File "/app/flaskr/blog.py", line 56, in create 2019-02-20T02:34:09.129558+00:00 app[web.1]: " VALUES ('{}', '{}', '{}','{}' )".format(title, body, ctime(), g.user['id']) 2019-02-20T02:34:09.129560+00:00 app[web.1]: psycopg2.ProgrammingError: syntax error at or near "s" 2019-02-20T02:34:09.129561+00:00 app[web.1]: LINE 2: Let's hope not to crash :))))))))))))', 'Wed Feb 20 02:34:09...

SolbiatiAlessandro commented 5 years ago

I am not able to replicate exactly the bug, but I put a string with really fancy special character and after hitting create I got "500 Error" and the error above in the logs. I tried more normal string and no error was raised.

SolbiatiAlessandro commented 5 years ago

to replicate error make a new post with content:

(this page will be moved in the about section)

About

Hi there I am Alessandro and I like VIM. I also like Python, Bill Evans, and LiBai (with other chinese poets). About my life? I graduated from Shanghai Tongji University and I will start working as a Software Engineer in couple of months at Facebook London.

Now

I am enjoying two free months before the start of my full-time in the UK, in the meanwhile I will be travelling the US to audit Machine Learning classes from Ivy League universities (I'll write a post about that).

Articles

SolbiatiAlessandro commented 5 years ago

it breaks on this 2019-03-03T12:49:01.555381+00:00 app[web.1]: psycopg2.ProgrammingError: syntax error at or near "ll" 2019-03-03T12:49:01.555383+00:00 app[web.1]: LINE 1: ... Learning classes from Ivy League universities (I'll write a...

SolbiatiAlessandro commented 5 years ago

TODO: fix strings that has ' inside when put body of a new post

SolbiatiAlessandro commented 5 years ago

https://stackoverflow.com/questions/3823735/psycopg2-equivalent-of-mysqldb-escape-string