Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-69814

Adding non-image file to Web Content Editor's file upload results in an img attribute and a broken image icon



      When creating a Web Content, we have the option to add a file in the Content section. It seems that the file chooser, or the Documents and Media uploader allows any file to be uploaded, when in reality it expects an image file.

      Because of the open parameters (no restrictions on image type/extension), it seems unexpected when the Web Content add file functionality sets an img attribute in the HTML source.

      Steps to Reproduce
      1. Start up clean Liferay DXP SP1 bundle
      2. Sign in as the administrator
      3. In the default Liferay DXP site, go into Contents > Web Content
      4. Add a new Web Content
      5. Assign a title, and in the Content section, click +
      6. Click the first icon (indicating an image/file icon)
      7. In the file uploader, click Choose a file, and select a TXT file
      8. After the file uploads, assert that a broken image icon is present
      9. Check the source code of the Web Content editor

      Actual Result
      An img src is set for the text file

      <p><img src="http://localhost:7080/documents/20143/0/Sample.txt/62ea9504-cc11-7c2d-09c7-747399d8bcf7?version=1.0" /></p>

      Expected Result
      Either (1) make it clear that non-image files cannot be uploaded/used and set these limits on the file chooser, or (2) parse non-image links to be displayed as links to the downloadable file.




            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created:
                Days since last comment:
                2 years, 5 weeks, 4 days ago


                Version Package
                7.0.0 DXP FP47
                7.0.0 DXP SP8