-
Notifications
You must be signed in to change notification settings - Fork 23k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FW][FIX] website: prevent cow if editing generic page with diverged URL #163162
Closed
fw-bot
wants to merge
1
commit into
odoo:saas-16.4
from
odoo-dev:saas-16.4-17.0-fix-generic-page-url-diverse-rde-lYcf-fw
Closed
[FW][FIX] website: prevent cow if editing generic page with diverged URL #163162
fw-bot
wants to merge
1
commit into
odoo:saas-16.4
from
odoo-dev:saas-16.4-17.0-fix-generic-page-url-diverse-rde-lYcf-fw
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the case of a generic page and its specific page: When the specific page change its URL, its view will still have the sam key as the generic page despite not being served on the same URL anymore and not really being the same ressource anymore. This is a bit weird conceptually. Indeed, the generic page is not shadowed by the specific one anymore. This is an issue because when going on the generic page and editing it, the save will actually "bug": it will not write on the generic view that you edited but the save will instead be "redirected" (through the COW mechanism) to the specific view. The editor will look like it did not save your change, while in fact it actually erased, behind the scene, the specific page content and replaced it by the one you tried to save on the generic page. You really just lost your specific page content without knowing it. This is a corner case of the COW mechanism and the holy grail rule of multi website (editing a website should only impact itself and not other websites): we serve both the generic content and its specific content on the website, which should never be possible except for this particular case of a view being linked to a page and the specific view's page having its URL changed. Note that an apparently good solution would be to adapt the view key to reflect its new page URL (as when you create a new page), but it's not possible. We don't do that for a simple reason: the page view's key could be t-called'd. Also note that a generic page is not something supposed to exist, even if we support it (and use it for /contactus), it's best to avoid it: 1. You can't do that through the UI unless going into debug mode 2. It does not make a lot of sense to share a whole page content on multiple websites, as it would be duplicated content (bad for SEO). Steps to reproduce: - Go to /contactus and enter edit mode - Change something like add "WEBSITE1" somewhere in the page - Open the page properties and change the url from /contactus to /contactuswebsite1 - Go to /contactus, which will still be available and now show the generic page - You will not see the "WEBSITE1" you added, which is what is expected as this is the generic page, the "WEBSITE1" is on the /contactuswebsite1 page - Enter edit mode and add something, like "GENERIC", save - The page will reload (as you saved) but your "GENERIC" will disappear, looking like it did not save your change - Now go to /contactuswebsite1, you will see that the "WEBSITE1" word is gone, and the "GENERIC" word is there This commit is making it so when you edit a generic page, it will write on it, bypassing the COW mechanism and the holy grail rule. It's a very niche case which will be handled as an exception. In Odoo 17 (last stable), we will replace this fix by another one which will prevent the access of a generic page when there is a specific page with a different URL. On top of the following OPWs, the bug was also reported internally on discord. opw-3760257 opw-3473923 task-3476840 X-original-commit: 4e90722
This PR targets saas-16.4 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
@fw-bot r+ |
robodoo
pushed a commit
that referenced
this pull request
Apr 25, 2024
In the case of a generic page and its specific page: When the specific page change its URL, its view will still have the sam key as the generic page despite not being served on the same URL anymore and not really being the same ressource anymore. This is a bit weird conceptually. Indeed, the generic page is not shadowed by the specific one anymore. This is an issue because when going on the generic page and editing it, the save will actually "bug": it will not write on the generic view that you edited but the save will instead be "redirected" (through the COW mechanism) to the specific view. The editor will look like it did not save your change, while in fact it actually erased, behind the scene, the specific page content and replaced it by the one you tried to save on the generic page. You really just lost your specific page content without knowing it. This is a corner case of the COW mechanism and the holy grail rule of multi website (editing a website should only impact itself and not other websites): we serve both the generic content and its specific content on the website, which should never be possible except for this particular case of a view being linked to a page and the specific view's page having its URL changed. Note that an apparently good solution would be to adapt the view key to reflect its new page URL (as when you create a new page), but it's not possible. We don't do that for a simple reason: the page view's key could be t-called'd. Also note that a generic page is not something supposed to exist, even if we support it (and use it for /contactus), it's best to avoid it: 1. You can't do that through the UI unless going into debug mode 2. It does not make a lot of sense to share a whole page content on multiple websites, as it would be duplicated content (bad for SEO). Steps to reproduce: - Go to /contactus and enter edit mode - Change something like add "WEBSITE1" somewhere in the page - Open the page properties and change the url from /contactus to /contactuswebsite1 - Go to /contactus, which will still be available and now show the generic page - You will not see the "WEBSITE1" you added, which is what is expected as this is the generic page, the "WEBSITE1" is on the /contactuswebsite1 page - Enter edit mode and add something, like "GENERIC", save - The page will reload (as you saved) but your "GENERIC" will disappear, looking like it did not save your change - Now go to /contactuswebsite1, you will see that the "WEBSITE1" word is gone, and the "GENERIC" word is there This commit is making it so when you edit a generic page, it will write on it, bypassing the COW mechanism and the holy grail rule. It's a very niche case which will be handled as an exception. In Odoo 17 (last stable), we will replace this fix by another one which will prevent the access of a generic page when there is a specific page with a different URL. On top of the following OPWs, the bug was also reported internally on discord. opw-3760257 opw-3473923 task-3476840 closes #163162 X-original-commit: 4e90722 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Romain Derie (rde) <rde@odoo.com>
qsm-odoo
deleted the
saas-16.4-17.0-fix-generic-page-url-diverse-rde-lYcf-fw
branch
April 25, 2024 17:18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the case of a generic page and its specific page: When the specific page change its URL, its view will still have the sam key as the generic page despite not being served on the same URL anymore and not really being the same ressource anymore. This is a bit weird conceptually.
Indeed, the generic page is not shadowed by the specific one anymore.
This is an issue because when going on the generic page and editing it, the save will actually "bug": it will not write on the generic view that you edited but the save will instead be "redirected" (through the COW mechanism) to the specific view.
The editor will look like it did not save your change, while in fact it actually erased, behind the scene, the specific page content and replaced it by the one you tried to save on the generic page. You really just lost your specific page content without knowing it.
This is a corner case of the COW mechanism and the holy grail rule of multi website (editing a website should only impact itself and not other websites): we serve both the generic content and its specific content on the website, which should never be possible except for this particular case of a view being linked to a page and the specific view's page having its URL changed.
Note that an apparently good solution would be to adapt the view key to reflect its new page URL (as when you create a new page), but it's not possible. We don't do that for a simple reason: the page view's key could be xpath'd. And it is even the case for the contactus page. Even if it is not a very legit flow to xpath a page view, because it makes (most of the time) that page not possible to edit, we have to support it.
Also note that a generic page is not something supposed to exist, even if we support it (and use it for /contactus), it's best to avoid it:
Steps to reproduce:
On top of the following OPWs, the bug was also reported internally on discord.
opw-3760257
opw-3473923
task-3476840
Forward-Port-Of: #163038
Forward-Port-Of: #159297