Skip to content

fix/df 1287: prevent 500s being thrown on a 404 - #1259

Merged
jbarnsley10 merged 4 commits into
mainfrom
fix/df-1287-prevent-500-on-404
Aug 13, 2026
Merged

fix/df 1287: prevent 500s being thrown on a 404#1259
jbarnsley10 merged 4 commits into
mainfrom
fix/df-1287-prevent-500-on-404

Conversation

@jbarnsley10

Copy link
Copy Markdown
Contributor

The error pages may get actioned before the Yar session has had chance to initialise fully (on PreAuth).
Therefore this defensive code is required to prevent random 404 urls (where no previous session, soperhaps from a hack attempt) throwing 500s

Comment thread src/server/utils/utils.js Outdated
}

return yar?.get('language') ?? defaultLang
return (sessionReady && yar ? yar.get('language') : null) ?? defaultLang

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.

the yar part can move into sessionReady rather than duplicating it

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.

Yes, but then lint complains that yar is possibly null. I either force the Yar type (to not be null) or add the additional 'yar' in the condition - unless you can think of a better way?

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.

Ignore me! I understand what you mean now - resolved

@sonarqubecloud

Copy link
Copy Markdown

@jbarnsley10
jbarnsley10 merged commit 47d588f into main Aug 13, 2026
9 checks passed
@jbarnsley10
jbarnsley10 deleted the fix/df-1287-prevent-500-on-404 branch August 13, 2026 09:05
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