Skip to content
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

Cannot use certain URLs for thumbnails #227

Closed
dragondave opened this issue Oct 16, 2019 · 1 comment
Closed

Cannot use certain URLs for thumbnails #227

dragondave opened this issue Oct 16, 2019 · 1 comment

Comments

@dragondave
Copy link
Contributor

dragondave commented Oct 16, 2019

  • ricecooker version: 0.6.36
  • Python version: 3.5.3
  • Operating System: Ubuntu (vader)

Description

If you import a thumbnail via HTML5AppNode(..., thumbnail='.jpg?itok=8gl2hL7q2'); the thumbnail file is rejected, and the crawler crashes with a ricecooker.exceptions.InvalidNodeException: Invalid node (ThumbnailFile must have one of the following extensions: ['jpg', 'jpeg', 'png'].

This means that importing arbitary URLs isn't a reasonable approach; it should probably succeed (it is probably a jpg file after all) or fail non-fatally.

What I Did

  File "/data/py35/lib/python3.5/site-packages/ricecooker/classes/nodes.py", line 195, in validate_tree
    assert child.validate_tree()
  File "/data/py35/lib/python3.5/site-packages/ricecooker/classes/nodes.py", line 193, in validate_tree
    self.validate()
  File "/data/py35/lib/python3.5/site-packages/ricecooker/classes/nodes.py", line 701, in validate
    raise InvalidNodeException("Invalid node ({}): {} - {}".format(ae.args[0], self.title, self.__dict__))
@ivanistheone
Copy link
Contributor

This should be handled correctly now, see
https://github.com/learningequality/ricecooker/blob/master/tests/test_thumbnails.py#L72-L77

Trying to make all extension-extraction go through the function extract_path_ext:
https://github.com/learningequality/ricecooker/blob/master/ricecooker/classes/files.py#L42-L58

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

No branches or pull requests

2 participants