1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-19 10:42:29 +03:00

Copying: Fixed issue with non-page links to page permalinks

Found during manual testing.
Added test case to cover.
This commit is contained in:
Dan Brown
2025-11-29 20:35:16 +00:00
parent 959981a676
commit 3cd3e73f60
3 changed files with 20 additions and 12 deletions

View File

@@ -17,17 +17,6 @@ class ReferenceChangeContext
$this->changes[] = [$oldEntity, $newEntity];
}
/**
* Get all the change pairs.
* Returned array is an array of pairs, where the first item is the old entity
* and the second is the new entity.
* @return array<array{0: Entity, 1: Entity}>
*/
public function getChanges(): array
{
return $this->changes;
}
/**
* Get all the new entities from the changes.
*/

View File

@@ -61,7 +61,7 @@ class ReferenceUpdater
$this->updateReferencesWithinEntity($new, $oldToEntity->getUrl(), $newToEntity->getUrl());
if ($newToEntity instanceof Page && $oldToEntity instanceof Page) {
$this->updateReferencesWithinPage($newToEntity, $oldToEntity->getPermalink(), $newToEntity->getPermalink());
$this->updateReferencesWithinEntity($new, $oldToEntity->getPermalink(), $newToEntity->getPermalink());
}
$reference->to_id = $newToEntity->id;
$reference->to_type = $newToEntity->getMorphClass();