#39532·gatsby

fix(gatsby-source-filesystem): url pathname can be null, causing path.parse to throw in filesystem utils

Author: Nam0101Created Apr 2, 2026Updated Jul 16, 2026
Labelsstatus: triage needed

Description

getParsedPath calls path.parse(Url.parse(url).pathname) without a null fallback. For malformed/edge URL inputs where pathname is null, path.parse throws a TypeError, which can crash callers like getRemoteFileExtension/getRemoteFileName. The TypeScript equivalent in gatsby-core-utils already guards this with || '', indicating this JS version is less safe.

Severity: medium File: packages/gatsby-source-filesystem/src/utils.js

Expected Behavior

The code should handle this case properly to avoid unexpected errors or degraded quality.