django-cms / djangocms-frontend

django CMS frontend is a plugin bundle for django CMS providing several components for the frontend, currently implemented with the popular Bootstrap 5 framework.
Other
42 stars 20 forks source link

[BUG] Wrong site used in link plugin #196

Closed adrien-delhorme closed 2 months ago

adrien-delhorme commented 3 months ago

Describe the bug

When using a LinkPlugin inside a static placeholder, the wrong (django) site is used when generating the link to a page located on another (django) site.

To Reproduce Consider a multi-site setup of django-cms: Site A and Site B.

On Site A

There is a page "Page A" site-a.com/path/to/page-a/.

On Site B

We create a LinkPlugin inside a static placeholder (or in a model's PlaceholderField like a djangocms-blog Post). We choose "Site A > Page A" in the internal page field. The generated link points to site-b.com/path/to/page-a/ (it does not exist).

Expected behavior The generated link must point to site-a.com/path/to/page-a/

Desktop (please complete the following information):

Additional context The link is correct when I remove and cms_page is not None in this condition: https://github.com/django-cms/djangocms-frontend/blob/7d2d682fa8898de8502a64f5040811597311c6de/djangocms_frontend/contrib/link/models.py#L70

fsbraun commented 3 months ago

Going through the logic, your suggestion seems right. Thanks for pointing this out!

fsbraun commented 2 months ago

Fixed in #195