Skip to content

Fix handling of non-object troubleshooting data - #7826

Open
vichekaoeun wants to merge 1 commit into
mozilla:mainfrom
vichekaoeun:fix-troubleshoot-validation
Open

vichekaoeun wants to merge 1 commit into
mozilla:mainfrom
vichekaoeun:fix-troubleshoot-validation

Conversation

@vichekaoeun

Copy link
Copy Markdown
Contributor

Resolved bug #3116 causing 500 error when troubleshooting data contains JSON that is not an object. Added tests for non-object JSON on form

@denyshon

Copy link
Copy Markdown
Contributor

Should we also add a check for this to clean_content() and display an error if the data is not a valid JSON/dict?

@vichekaoeun

Copy link
Copy Markdown
Contributor Author

yes I think that would make sense but I think it could go into a separate function like clean_troubleshooting since it would mix unrelated issues to the wrong field otherwise.

@vichekaoeun

Copy link
Copy Markdown
Contributor Author

Hi @denyshon could you review my change

@denyshon

denyshon commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

@vichekaoeun sure, but I'm not a part of the team, so I don't have write access to the repo and can't speak on their behalf

you may want to ping @escattone instead

Comment thread kitsune/questions/forms.py Outdated
raise forms.ValidationError(_("Question content cannot be empty."))
return content

def clean_troubleshooting(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just a neat: let's add a docstring for this method

@vichekaoeun

Copy link
Copy Markdown
Contributor Author

Hi @escattone could you help review my changes?

Comment thread kitsune/questions/forms.py Outdated
return troubleshooting

try:
parsed = json.loads(troubleshooting)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will change the current behavior and limit the troubleshooting data only to json. That works for the JS code that pulls json but it will no longer accept manually copied raw data from about:support

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

doesn't copied raw data follow the json format?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hi @akatsoulas could you review

@vichekaoeun
vichekaoeun force-pushed the fix-troubleshoot-validation branch from ce4ca5b to 8f05ccd Compare September 17, 2026 03:31
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.

3 participants