mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-07 21:24:56 -05:00
POST_expando: gracefully fail when called on link with no child.
Previously if POST_expando was called on a link that has no link_child (i.e. no selftext or media object to show in the expando) it would cause an exception. This catches the bad case early and aborts with a 404.
This commit is contained in:
committed by
Chad Birch
parent
8b69aa1635
commit
c6fd299788
@@ -3162,7 +3162,10 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
|
||||
wrapped = wrap_links(link)
|
||||
wrapped = list(wrapped)[0]
|
||||
return websafe(spaceCompress(wrapped.link_child.content()))
|
||||
link_child = wrapped.link_child
|
||||
if not link_child:
|
||||
abort(404, 'not found')
|
||||
return websafe(spaceCompress(link_child.content()))
|
||||
|
||||
@validatedForm(VUser('password', default=''),
|
||||
VModhash(),
|
||||
|
||||
Reference in New Issue
Block a user