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 almost 3 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 almost 3 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 almost 3 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 2 years ago
- Has duplicate Bug #99697: Copying a page with existing sys_redirect throws error added
Updated by Markus Klein over 1 year ago
I stipulate: redirects must never be copied.
Updated by Andy Meier over 1 year 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 over 1 year 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.
Updated by Christian Ludwig 4 months ago
A related issue exists in yoast_seo. See https://github.com/Yoast/Yoast-SEO-for-TYPO3/issues/602
So I think the idea of @Rozbeh Chiryai Sharahi`s patch would be helpful in that case as well.
And related to this issue:
I see no sense in copying automatically generated redirects to new pages. The pages are new and have never been linked from somewhere else before. In addition when the source is copied unchanged, we'll have multiple redirects with the same source uri what causes problems (where should we redirect to? To the new pasted page or to the old source page that was copied).
Updated by Stefan Bürk 4 months ago
Since TYPo3 v12 redirects are only on PID= 0 or site roots. They are not created on (standard) pages directly (expect site root pages)
Updated by Andreas Kießling 3 months ago
- Related to Feature #104740: Exclude tables when copying a page record in the backend added
Updated by Andreas Kießling 3 months ago
Would be great to have this in the core! I also have some log tables that store records on the page where the plugin is used --> no need to copy them when the page is duplicated.