Forward-port: Fix copying clone referencing other document

Fixes #5282 (closed)

Forward-port of !6864 (merged)

Merge request reports

Loading