Skip to content

[Bug]: Video field - null ID crash + YouTube referrer policy error #1080

@Navino16

Description

@Navino16

Pimcore version

11.5.14.1 / admin-ui-classic-bundle 1.7.16 (verified also on 12.x / admin-ui-classic-bundle 2.x)

Steps to reproduce

  1. Create a DataObject class with a Video field
  2. Create an object instance
  3. Open the Video field without setting any value (or clear an existing value)
  4. The video preview attempts to render

Actual Behavior

  1. Null ID crash: JavaScript error Cannot read properties of null (reading 'indexOf') because this.data.data is null and .indexOf() is called without null check.

  2. Referrer Policy error: When a YouTube video IS set, error 153 "Video unavailable" can occur due to missing referrerpolicy attribute.

Expected Behavior

  1. No JavaScript error when video data is null
  2. YouTube videos should load correctly with proper referrer policy

Affected file: public/js/pimcore/object/tags/video.js (around line 355)

Suggested fix:

// Change from:
if (this.data.data.indexOf('PL') === 0) {
// To:
if (this.data.data?.indexOf('PL') === 0) {

// And add referrerpolicy to iframes:
<iframe ... referrerpolicy="strict-origin-when-cross-origin" ...>

Related: A similar referrer policy fix is needed in pimcore/pimcore for models/Document/Editable/Video.php (pimcore/pimcore#18937)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions