Skip to content

[Bug]: Document Link false "infinite loop" when linking to object/asset with same numeric ID #73

@twin-elements

Description

@twin-elements

OpenDXP version

1.3.0

Steps to reproduce

In OpenDXP Admin, Document Link editor incorrectly blocks linking to an internal object/asset when its numeric id equals the current document link id.

This is a false positive recursion check.
Recursion should be prevented only for document -> same document.

  1. Create a Document Link in the document tree (e.g. key: Blog).
  2. Ensure there is a DataObject (e.g. PostCategory) with the same numeric id as the document link (IDs are per-table, so collisions are possible).
  3. Try to set this object as internal target:
    • by drag & drop: nothing happens
    • by search picker: error shown: The link is redirecting to itself, causing an infinite loop

Actual Behavior

UI blocks selection based on id equality only, regardless of element type.

Expected Behavior

Document Link should accept internal target when target type is object (or asset), even if numeric id matches.

admin-bundle checks recursion in JS using only id:

  • vendor/open-dxp/admin-bundle/public/js/opendxp/document/link.js:459
  • vendor/open-dxp/admin-bundle/public/js/opendxp/document/link.js:474
  • vendor/open-dxp/admin-bundle/public/js/opendxp/document/link.js:580

Current logic (simplified):

if (data.records[0].data.id == currentId) { ... }
...
if (this.data.id == data.id) { show link_recursion_error }

But id is not globally unique across document, object, and asset.

Backend confirms recursion prevention is document-only:

  • vendor/open-dxp/opendxp/models/Document/Link.php:274-277

Fix

Restrict recursion check to document type only:

const isSelfDocument =
  data.records[0].data.elementType === "document" &&
  data.records[0].data.id == currentId;

// and in search callback:
const isSelfDocument = data.type === "document" && this.data.id == data.id;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions