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

Validate landing page base paths must start with / #9629

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

richardTowers
Copy link
Contributor

We're being a bit sneaky with landing pages, and setting base_path to be the entire user entered slug. Unlike with other editions, where the slug gets appended to /government/something, this lets the user set the whole base path.

Consequently, it's important that it starts with a slash, otherwise publishing API will reject it. As slugs can only be provided for landing pages when they're first created, leaving off the slash results in a situation the user can't recover from (the document is created with a bad slug, and there's no interface to change it).

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

app/models/landing_page.rb Fixed Show fixed Hide fixed
Copy link
Contributor

@KludgeKML KludgeKML left a comment

Choose a reason for hiding this comment

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

LGTM

We're being a bit sneaky with landing pages, and setting base_path to be
the entire user entered slug. Unlike with other editions, where the slug
gets appended to /government/something, this lets the user set the whole
base path.

Consequently, it's important that it starts with a slash, otherwise
publishing API will reject it. As slugs can only be provided for landing
pages when they're first created, leaving off the slash results in a
situation the user can't recover from (the document is created with a
bad slug, and there's no interface to change it).
@richardTowers richardTowers merged commit 79cbfb6 into main Nov 19, 2024
19 checks passed
@richardTowers richardTowers deleted the validate-landing-page-base-path branch November 19, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants