Guard blob name in highlight mixin against null

What does this MR do and why?

When a blob's name comes back null from the getBlobInfo GraphQL query (the RepositoryBlob.name field is explicitly nullable in the schema), the unguarded name.endsWith(extension) call in initHighlightWorker throws a TypeError. This crashes the blob page's highlighting/blame setup before any early return can happen.

This MR adds a null guard so the extension lookup is skipped when name is missing, matching the nullable schema contract.

Root cause

Introduced in !174877 (merged) (glimmer highlighting), which added the unguarded name.endsWith(extension) call when scanning FILE_EXTENSION_MAPPING_HLJS.

References

Screenshots or screen recordings

N/A — this is a crash fix in highlighting logic with no visible UI change.

How to set up and validate locally

  1. Run the Jest spec:
    npx jest spec/frontend/repository/mixins/highlight_mixin_spec.js
  2. Confirm the two new when the blob has no name cases pass (they assert initHighlightWorker does not throw when name is null/undefined).

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading