Problem/Motivation

PDF placeholder thumbnails are not rendering in the file browser grid/list view.

The JavaScript responsible for injecting the placeholder image contains invalid
middle-dot characters (·) instead of spaces inside the HTML string.
Because of this, the generated <img> tag is malformed
and not parsed correctly by the browser.

Problematic code:

$(thumbnailWrapper[i]).prepend(
  '<img·style="width:100px;·height:100px;"·src="/modules/contrib/file_browser/images/document_placeholder.svg"/>'
);

bug-img

Steps to reproduce

  1. Open the File Entity Browser widget.
  2. Upload or select a PDF file.
  3. Observe that no thumbnail placeholder icon is displayed.
  4. Inspect the DOM and verify the image tag markup is invalid.

Proposed resolution

Replace the middle-dot characters with proper spaces in the HTML string.

$(thumbnailWrapper[i]).prepend(
  '<img style="width:100px; height:100px;" src="/modules/contrib/file_browser/images/document_placeholder.svg"/>'
);

fix-img

Remaining tasks

  • Replace invalid characters with spaces in the JavaScript file.
  • Verify PDF placeholder thumbnails render correctly.
  • Test across supported browsers.

User interface changes

  • PDF files will display a placeholder thumbnail icon.
  • No layout or workflow changes.

API changes

  • None.

Data model changes

  • None.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sriram s created an issue. See original summary.

sriram_s’s picture

Issue summary: View changes
sriram_s’s picture

Issue summary: View changes
sriram_s’s picture

Issue summary: View changes
StatusFileSize
new26.08 KB
new911 bytes

daniel.j made their first commit to this issue’s fork.

daniel.j’s picture

Status: Active » Needs review
Issue tags: -JavaScript +JavaScript

Moved patch change into branch and openned MR.

d.fisher’s picture

Version: 2.0.7 » 2.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: -JavaScript +JavaScript

This looks good to me. Marking RTBC. Changing target branch to 2.x-dev.

d.fisher’s picture

Status: Reviewed & tested by the community » Fixed

Fixed and released in 2.0.8. Thank you for the report, the fixes, the reviews etc.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.