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 map alias url #844

Merged
merged 2 commits into from
May 21, 2024
Merged

Fix map alias url #844

merged 2 commits into from
May 21, 2024

Conversation

wlorenzetti
Copy link
Member

@wlorenzetti wlorenzetti commented May 9, 2024

Fixes a regression introduced by: #836

Closes: #843

Motivation

Checking the getattr statement before the default value that in the case of url alias return a 404.

Screenshot_20240509_173251

@wlorenzetti wlorenzetti added the bug Something isn't working label May 9, 2024
@wlorenzetti wlorenzetti added this to the v3.8 milestone May 9, 2024
@wlorenzetti wlorenzetti requested a review from Raruto May 9, 2024 15:34
@wlorenzetti wlorenzetti self-assigned this May 9, 2024
Comment on lines +85 to +91
try:
group = self.project.group
except:
group = get_object_or_404(Group, slug=kwargs['group_slug'])

groupSerializer = GroupSerializer(
getattr(self.project, 'group', get_object_or_404(Group, slug=kwargs['group_slug'])),
group,
Copy link
Contributor

@Raruto Raruto May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wlorenzetti I tried it like the following and it works the same:

# group serializer
# try:
#     group = self.project.group
# except:
#     group = get_object_or_404(Group, slug=kwargs['group_slug'])

groupSerializer = GroupSerializer(
    self.project.group,
    projectId=str(self.project.pk),
    projectType=kwargs['project_type'],
    request=self.request
)

Just to know, the CU plugin is a special case of projects without a group? ref: e634b10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Raruto do you mean CDU?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wlorenzetti maybe it's a mispelling, I find it through git blame: e634b10 (commited on Nov 27, 2017)

@Raruto Raruto marked this pull request as ready for review May 10, 2024 06:33
@wlorenzetti wlorenzetti merged commit 23d9721 into dev May 21, 2024
4 checks passed
@wlorenzetti wlorenzetti deleted the broken_url_alias branch May 21, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

404 page not found for map URL alias
2 participants