Skip to content

FIX: Check tag group names in form template validator #33850

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Lhcfl
Copy link
Contributor

@Lhcfl Lhcfl commented Jul 25, 2025

The previous form template validator did not detect non-existent tag group names, which would result in the page being saved normally when an incorrect name was entered, but causing the interface to crash during preview and a 500 error to be thrown when the user used it.

This commit adds detection for non-existent tag group names and fixes this issue

The previous form template validator did not detect non-existent tag
group names, which would result in the page being saved normally when
an incorrect name was entered, but causing the interface to crash during
preview and a 500 error to be thrown when the user used it.

This commit adds detection for non-existent tag group names and fixes
this issue
@github-actions github-actions bot added the i18n PRs which update English locale files or i18n related code label Jul 25, 2025
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/form-templates-preview-broken-with-tag-group/372744/3

@@ -31,6 +31,8 @@ def validate(record)
check_ids(record, field, existing_ids)
check_descriptions_html(record, field)
end

check_tag_groups(record, yaml.map { |f| f["tag_group"] }.compact.map(&:downcase).uniq)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
check_tag_groups(record, yaml.map { |f| f["tag_group"] }.compact.map(&:downcase).uniq)
check_tag_groups(record, yaml.map { |f| f["tag_group"] })

I feel like .compact.map(&:downcase).uniq should be done in check_tag_groups. Otherwise, it isn't clear that the tag_group_names argument expects an array of tag group names that have been compacted and downcased.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea! resolved this.

@tgxworld
Copy link
Contributor

but causing the interface to crash during preview and a 500 error to be thrown when the user used it.

Should we also prevent this? Otherwise, existing site with invalid values will still encounter a 500 error.

@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/daily-summary-9pm-utc/291850/579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n PRs which update English locale files or i18n related code
Development

Successfully merging this pull request may close these issues.

3 participants