diff --git a/src/AliasStorageHelper.php b/src/AliasStorageHelper.php index e654f6a4d..c830ec044 100644 --- a/src/AliasStorageHelper.php +++ b/src/AliasStorageHelper.php @@ -114,14 +114,14 @@ public function save(array $path, $existing_alias = NULL, $op = NULL) { return NULL; } + // Don't create a new alias if it is identical to the current alias. + if ($existing_alias && $existing_alias->getAlias() == $alias) { + return NULL; + } + // Update the existing alias if there is one and the configuration is set to // replace it. if ($existing_alias && $config->get('update_action') == PathautoGeneratorInterface::UPDATE_ACTION_DELETE) { - // Skip replacing the current alias with an identical alias. - if ($existing_alias->getAlias() == $alias) { - return NULL; - } - $old_alias = $existing_alias->getAlias(); $existing_alias->setAlias($alias)->save();