collective / collective.nitf

A Dexterity-based content type inspired on the News Industry Text Format specification
8 stars 3 forks source link

img src="../" breaks the page #227

Open shogunbr opened 5 years ago

shogunbr commented 5 years ago

A user have added a news article with an img src="../" and it breaks the entire page.

To reproduce it, create a news article, click on HTML and add this code: <p><img class="image-inline external-image" src="../" /></p>

Or use the WYSIWYG to add an external image with URL: ".." (without the quotes)

2019-05-29 15:07:52 ERROR plone.app.textfield Transform exception
Traceback (most recent call last):
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.app.textfield-1.2.11-py2.7.egg/plone/app/textfield/transform.py", line 46, in __call__
    encoding=value.encoding)
  File "/opt/plone/plone.clean/buildout-cache/eggs/Products.PortalTransforms-2.1.12-py2.7.egg/Products/PortalTransforms/TransformEngine.py", line 171, in convertTo
    usedby=usedby, **kwargs)
  File "/opt/plone/plone.clean/buildout-cache/eggs/Products.PortalTransforms-2.1.12-py2.7.egg/Products/PortalTransforms/chain.py", line 51, in convert
    data = transform.convert(orig, data, **kwargs)
  File "/opt/plone/plone.clean/buildout-cache/eggs/Products.PortalTransforms-2.1.12-py2.7.egg/Products/PortalTransforms/Transform.py", line 196, in convert
    return self._v_transform.convert(*args, **kwargs)
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.outputfilters-1.15.3-py2.7.egg/plone/outputfilters/transforms/html_to_plone_outputfilters_html.py", line 47, in convert
    res = apply_filters(filters, orig)
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.outputfilters-1.15.3-py2.7.egg/plone/outputfilters/__init__.py", line 6, in apply_filters
    res = filter(data)
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.outputfilters-1.15.3-py2.7.egg/plone/outputfilters/filters/resolveuid_and_caption.py", line 121, in __call__
    self.feed(data)
  File "/usr/lib/python2.7/sgmllib.py", line 104, in feed
    self.goahead(0)
  File "/usr/lib/python2.7/sgmllib.py", line 138, in goahead
    k = self.parse_starttag(i)
  File "/usr/lib/python2.7/sgmllib.py", line 296, in parse_starttag
    self.finish_starttag(tag, attrs)
  File "/usr/lib/python2.7/sgmllib.py", line 338, in finish_starttag
    self.unknown_starttag(tag, attrs)
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.outputfilters-1.15.3-py2.7.egg/plone/outputfilters/filters/resolveuid_and_caption.py", line 356, in unknown_starttag
    image, fullimage, src, description = self.resolve_image(src)
  File "/opt/plone/plone.clean/buildout-cache/eggs/plone.outputfilters-1.15.3-py2.7.egg/plone/outputfilters/filters/resolveuid_and_caption.py", line 268, in resolve_image
    description = aq_acquire(fullimage, 'Description')()
AttributeError: Description
2019-05-29 15:07:52 ERROR Zope.SiteErrorLog 1559153272.120.984577331057 http://localhost:8080/Plone/teste/view
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.autoform.view, line 47, in __call__
  Module plone.autoform.view, line 38, in render
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 946, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /opt/plone/plone.clean/buildout-cache/eggs/collective.nitf-2.1b4-py2.7.egg/collective/nitf/browser/templates/view.pt
   - Line 36, Column 10
   - Expression: <PathExpr standard:u'context/text/output|nothing'>
   - Names:
      {'args': (),
       'container': <NITF at /Plone/teste>,
       'context': <NITF at /Plone/teste>,
       'default': <object object at 0x7fdb7aabd560>,
       'here': <NITF at /Plone/teste>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7fdb6a9aa730>,
       'request': <HTTPRequest, URL=http://localhost:8080/Plone/teste/view>,
       'root': <Application at >,
       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7fdb6d0383d0>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.metaclass.SimpleViewClass from /opt/plone/plone.clean/buildout-cache/eggs/collective.nitf-2.1b4-py2.7.egg/collective/nitf/browser/templates/view.pt object at 0x7fdb6a75d9d0>,
       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7fdb6acec250>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 140, in _eval
  Module zope.tales.expressions, line 124, in _eval
  Module Products.PageTemplates.Expressions, line 97, in trustedBoboAwareZopeTraverse
  Module zope.traversing.adapters, line 136, in traversePathElement
   - __traceback_info__: (RichTextValue object. (Did you mean <attribute>.raw or <attribute>.output?), 'output')
  Module zope.traversing.adapters, line 42, in traverse
   - __traceback_info__: (RichTextValue object. (Did you mean <attribute>.raw or <attribute>.output?), 'output', [])
  Module plone.app.textfield.value, line 84, in output
  Module plone.app.textfield.value, line 110, in output_relative_to
  Module plone.app.textfield.transform, line 69, in __call__
TransformError: Error during transformation