Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix crash in url preview #1701

Merged
merged 1 commit into from Dec 15, 2016
Merged

Conversation

mbachry
Copy link
Contributor

@mbachry mbachry commented Dec 14, 2016

Hi, it's an attempt to fix traceback I found in synapse logs:

python[10786]: Traceback (most recent call last):
python[10786]:   File "/opt/synapse/lib/python2.7/site-packages/synapse/http/server.py", line 118, in wrapped_request_handler
python[10786]:     yield request_handler(self, request)
python[10786]:   File "/opt/synapse/lib/python2.7/site-packages/twisted/internet/defer.py", line 1299, in _inlineCallbacks
python[10786]:     result = g.send(result)
python[10786]:   File "/opt/synapse/lib/python2.7/site-packages/synapse/rest/media/v1/preview_url_resource.py", line 199, in _async_render_GET
python[10786]:     og = decode_and_calc_og(body, media_info['uri'], encoding)
python[10786]:   File "/opt/synapse/lib/python2.7/site-packages/synapse/rest/media/v1/preview_url_resource.py", line 337, in decode_and_calc_og
python[10786]:     og = _calc_og(tree, media_uri)
python[10786]:   File "/opt/synapse/lib/python2.7/site-packages/synapse/rest/media/v1/preview_url_resource.py", line 384, in _calc_og
python[10786]:     og['og:title'] = title[0].text.strip() if (title and title[0]) else None
python[10786]: AttributeError: 'NoneType' object has no attribute 'strip'

I added test_missing_title_and_broken_h1 to test_preview.py which reproduces this problem.

(Thanks for fantastic piece of software. Besides this minor issue above, Synapse has been very reliable and fast for me)

Signed-off-by: Marcin Bachry <hegel666@gmail.com>
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

2 similar comments
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@erikjohnston
Copy link
Member

@matrixbot ok to test

@erikjohnston
Copy link
Member

This looks great! Thanks!

(The Sytest Dendron test failure looks like the tests failed to start on our jenkins box, and so is spurious)

@erikjohnston erikjohnston merged commit 4da3fc0 into matrix-org:develop Dec 15, 2016
@smgoller
Copy link

I'm currently having a problem with 0.18.5, running on centos 7. With URL Preview turned on, I get this crash shortly after starting (I believe it's try to parse a url in our room history):

[ 116.606994] traps: python2.7[9269] trap invalid opcode ip:7f09f2b16bee sp:7ffc6c1bd658 error:0 in etree.so[7f09f28f8000+4b7000]"

After mentioning this in #matrix-dev, I was asked to post a comment here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants