Skip to content
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

[FIX] base: serve_fallback infinite redirection #154883

Conversation

Julien00859
Copy link
Member

Create an attachment with an URL to a static file that does not exists, e.g. '/web/static/idontexist.png'. Inside your browser try to access that file, open localhost:8069/web/static/idontexist.png. The browser fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the controllers, _serve_fallback kicks in and attempt to find a resource outside of the router that matches the URL. In case it finds an attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via _serve_fallback, only deliver stored files.

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.
@robodoo
Copy link
Contributor

robodoo commented Feb 21, 2024

@C3POdoo C3POdoo requested review from a team, xmo-odoo and ryv-odoo and removed request for a team February 21, 2024 13:28
@C3POdoo C3POdoo added the RD research & development, internal work label Feb 21, 2024
@sleepy-monax
Copy link
Member

LGTM 👍

@Julien00859
Copy link
Member Author

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 4, 2024
Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.

closes #154883

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
@robodoo robodoo closed this Mar 4, 2024
gamarino pushed a commit to numaes/numa-public-odoo that referenced this pull request Mar 9, 2024
Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.

closes odoo/odoo#154883

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
@fw-bot fw-bot deleted the 16.0-base-web_image_static_path_404-juc branch March 18, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants