Commit 1e766c5c authored by Helmut Hummel's avatar Helmut Hummel Committed by Oliver Hader
Browse files

[BUGFIX] Loosen site check for records not stored in site context

When saving a record on a page that is not part of a site,
the slug field of this record, despite being set to "uniqueInSite"
is not checked for uniqueness, as it is assumed unique enough.

This assumption needs to be applied as well when resolving
the record, instead of assuming the resolved record is not part
of the current site.

Releases: master, 9.5
Resolves: #91438
Change-Id: I347909b9b4caa523de3ad8e5d84c465e5d57b052
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64520


Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
parent 78ea2ce3
...@@ -303,6 +303,9 @@ class SlugHelper ...@@ -303,6 +303,9 @@ class SlugHelper
$siteOfCurrentRecord = $siteFinder->getSiteByPageId($pageId); $siteOfCurrentRecord = $siteFinder->getSiteByPageId($pageId);
} catch (SiteNotFoundException $e) { } catch (SiteNotFoundException $e) {
// Not within a site, so nothing to do // Not within a site, so nothing to do
// TODO: Rather than silently ignoring this misconfiguration,
// a warning should be thrown here, or maybe even let the
// exception bubble up and catch it in places that uses this API
return true; return true;
} }
foreach ($records as $record) { foreach ($records as $record) {
......
...@@ -95,7 +95,11 @@ trait SiteAccessorTrait ...@@ -95,7 +95,11 @@ trait SiteAccessorTrait
$expectedSite = $this->getSiteMatcher()->matchByPageId($pageId); $expectedSite = $this->getSiteMatcher()->matchByPageId($pageId);
return $expectedSite->getRootPageId() === $this->site->getRootPageId(); return $expectedSite->getRootPageId() === $this->site->getRootPageId();
} catch (SiteNotFoundException $exception) { } catch (SiteNotFoundException $exception) {
return false; // Same as in \TYPO3\CMS\Core\DataHandling\SlugHelper::isUniqueInSite
// where it is assumed that a record, that is not in site context,
// but still configured uniqueInSite is unique. We therefore must assume
// the resolved record to be rightfully part of the current site.
return true;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment