#87454Slug/URL segment - /1 is wrongly saved, when trying to set / on rootpage.
Description
If you create a sysFolder or a standard page for that matter as a container for multiple sites, then it is impossible to make the root page of these sites to have just / as slug. It always adds 1.
The reason seems to be, that when validating the slug, it also considers the slug of the parent container folder, even though the root page of the site is configured in the Sites module.
I conclude this, as if I go and manipulate the DB-record of the container folder and replace / with container in slug, then everything works as expected again.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 2
History 7
-
Stig Nørgaard Færch changed category <span data-processor="relativetime" data-value="2019-01-16T13:34:04+00:00" > 01/16/19, 13:34 </span>
-
Guido Schmechel changed Related to #87884 <span data-processor="relativetime" data-value="2019-03-12T16:26:33+00:00" > 03/12/19, 16:26 </span>
-
Riccardo De Contardi changed Related to #86727 <span data-processor="relativetime" data-value="2019-04-30T23:35:23+00:00" > 04/30/19, 23:35 </span>
-
Stefan Neufeind commented <span data-processor="relativetime" data-value="2019-07-30T12:03:13+00:00" > 07/30/19, 12:03 </span>
-
Stefan Busemann commented <span data-processor="relativetime" data-value="2019-08-12T13:24:38+00:00" > 08/12/19, 13:24 </span>
I can confirm the issue.
Our setup:
- default lang: de / no language slug
- overlay: en / en as language slug
If I go the root page (in default language – pid 1) and click “recalculate URL segment”, the slug changes from “/” to “/1”
-
Stefan Busemann commented <span data-processor="relativetime" data-value="2019-08-12T15:17:44+00:00" > 08/12/19, 15:17 </span>
By changing Web/typo3/sysext/core/Classes/DataHandling/SlugHelper.php
to
public function isUniqueInSite(string $slug, RecordState $state): bool { $pageId = $state->resolveNodeAggregateIdentifier(); $recordId = $state->getSubject()->getIdentifier(); $languageId = $state->getContext()->getLanguageId(); if (!MathUtility::canBeInterpretedAsInteger($pageId)) { // If this is a new page, we use the parent page to resolve the site $pageId = $state->getNode()->getIdentifier(); } $pageId = (int)$pageId; if ($pageId < 0) { $pageId = $this->resolveLivePageId($recordId); } $queryBuilder = $this->createPreparedQueryBuilder(); $this->applySlugConstraint($queryBuilder, $slug); $this->applyRecordConstraint($queryBuilder, $recordId); $this->applyLanguageConstraint($queryBuilder, $languageId); $this->applyWorkspaceConstraint($queryBuilder); $statement = $queryBuilder->execute(); $records = $this->resolveVersionOverlays( $statement->fetchAll() ); if (count($records) === 0) { return true; } // The installation contains at least ONE other record with the same slug // Now find out if it is the same root page ID $siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class); $siteMatcher->refresh(); $siteOfCurrentRecord = $siteMatcher->matchByPageId($pageId); foreach ($records as $record) { try { $recordState = RecordStateFactory::forName($this->tableName)->fromArray($record); $siteOfExistingRecord = $siteMatcher->matchByPageId( (int)$recordState->resolveNodeAggregateIdentifier() ); } catch (SiteNotFoundException $exception) { // In case not site is found, the record is not // organized in any site or pseudo-site continue; } if ($siteOfExistingRecord->getRootPageId() === $siteOfCurrentRecord->getRootPageId()) { if ($pageId === (int)$recordState->getNode()->getIdentifier()) { // if we are on the same page, we can skip it and return true return true; } else { return false; } } } // Otherwise, everything is still fine return true; }I added this if statement:
if ($pageId === (int)$recordState->getNode()->getIdentifier()) { // if we are on the same page, we can skip it and return true return true; } else { return false; } -
Benni Mack commented and changed status
NewClosed assigned to Benni Mack target version <span data-processor="relativetime" data-value="2026-10-24T06:56:27+00:00" > 10/24/26, 06:56 </span>Re-checked on main (v15.0.0-dev): with a container page (slug /) on pid 0 holding two site roots, each with its own site configuration, both roots keep slug / when saved through DataHandler. The container isn’t part of any site, so SlugHelper::isUniqueInSite() skips it (SiteFinder throws SiteNotFoundException) instead of treating it as a duplicate. This was addressed together with #87884 / #90736. A /1 now only shows up when another page inside the same site really uses /. Closing; please open a new issue with steps to reproduce if you still see this on 13.4 or later.
Still an issue. Manually adjusting the slug in the database works, as expected.