Bug #96651
openWhen pasting a page with redirects => error 'Attempt to insert record "sys_redirect…'
0%
Description
Steps to reproduce:
- Create a new page, save
- Rename page, update slug => creates a redirect (check pid in table sys_redirect)
- Copy this page and paste into another page
- The following error message is thrown:
1: Attempt to insert record "sys_redirect:3" on a page (8) that can't store record type.
(the UID (8) is the one of the newly inserted page)
Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75020
Updated by Rozbeh Chiryai Sharahi over 2 years ago
This happens also on version 12
The reason for the error message
sys_redirect table is not allowed on standard pages
How to proceed
I think this depends on the answer to the question: "Should redirects be allowed on standard pages?".
If yes
It might be simple: "[BUGFIX] Allow sys_redirect on standard pages". (I could provide a patch, if needed)
If no
In this case we assume that sys_redirect is not allowed on standard pages for good reasons. For example: Avoid spreading redirects in page-tree, ...
The auto-redirects, however, get stored on standard-pages (the page which has a changed slug), which, on copy-pasting a page, leads to the attempt of data-handler to insert redirects on a target which is a standard-page. Summary: auto-redirects are created on standard-pages although not allowed by TCA.
Therefore, i see two more interesting possibilities to tackle this:
1) Change redirects extension to not create redirects on standard-pages (might be quite some work)
2) Introduce an option to exclude tables to be copied along with pages (would not directly address the issue and is rather a feature than a bugfix)
The reason I think 2) can be an option is that copying redirects along with pages could be wrong in many many cases. I'd think redirects belong to the copied pages most of the time ... unless it's a copied sys-folder, were the redirects are some kind of "pack-of-disabled-redirect-templates" or so. However in that case, it would still be possible to reactivate via TCA and allow sys-redirect entries on standard pages, on project level.
I provided a WIP patch for 2, in case it is considered a good solution.
Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75020
Updated by Oliver Gassner over 1 year ago
- Has duplicate Bug #99697: Copying a page with existing sys_redirect throws error added
Updated by Markus Klein about 1 year ago
I stipulate: redirects must never be copied.
Updated by Andy Meier 10 months ago
@Rozbeh Chiryai Sharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.
@Stefan Bürk I hope, the fix will make it's way to the main branch soon.
Thanks to all for your effort!
Updated by Rozbeh Chiryai Sharahi 9 months ago
Andy Meier wrote in #note-8:
@Rozbeh Chiryai Sharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.
@Stefan Bürk I hope, the fix will make it's way to the main branch soon.
Thanks to all for your effort!
Happy to hear that. If further support is needed, let me know.