-
Notifications
You must be signed in to change notification settings - Fork 3
[Bug]: Document Link false "infinite loop" when linking to object/asset with same numeric ID #73
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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.
- Create a
Document Linkin the document tree (e.g. key:Blog). - Ensure there is a DataObject (e.g.
PostCategory) with the same numericidas the document link (IDs are per-table, so collisions are possible). - 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:459vendor/open-dxp/admin-bundle/public/js/opendxp/document/link.js:474vendor/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;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working