diff --git a/Classes/ContentRepository/NodeTranslationService.php b/Classes/ContentRepository/NodeTranslationService.php index cfcc0ff..1dd3aae 100644 --- a/Classes/ContentRepository/NodeTranslationService.php +++ b/Classes/ContentRepository/NodeTranslationService.php @@ -213,13 +213,13 @@ public function translateNode(NodeInterface $sourceNode, NodeInterface $targetNo } foreach ($properties as $propertyName => $propertyValue) { - if ($targetNode->getProperty($propertyName) != $propertyValue) { - $targetNode->setProperty($propertyName, $propertyValue); + // Make sure the uriPathSegment is valid + if ($propertyName === 'uriPathSegment' && !preg_match('/^[a-z0-9\-]+$/i', $propertyValue)) { + $propertyValue = $this->nodeUriPathSegmentGenerator->generateUriPathSegment(null, $propertyValue); } - // Make sure the uriPathSegment is valid - if ($targetNode->getProperty('uriPathSegment') && !preg_match('/^[a-z0-9\-]+$/i', $targetNode->getProperty('uriPathSegment'))) { - $targetNode->setProperty('uriPathSegment', $this->nodeUriPathSegmentGenerator->generateUriPathSegment(null, $targetNode->getProperty('uriPathSegment'))); + if ($targetNode->getProperty($propertyName) != $propertyValue) { + $targetNode->setProperty($propertyName, $propertyValue); } } }