MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / isPathValid

Function isPathValid

packages/web/src/features/git/utils.ts:10–17  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

8// @note: we don't allow directory traversal
9// or null bytes in the path.
10export const isPathValid = (path: string) => {
11 const pathSegments = path.split('/');
12 if (pathSegments.some(segment => segment === '..') || path.includes('\0')) {
13 return false;
14 }
15
16 return true;
17}
18
19export const normalizePath = (path: string): string => {
20 // Normalize the path by...

Callers 5

getFileSourceForRepoFunction · 0.90
getFileBlameFunction · 0.90
getFolderContentsFunction · 0.90
getTreeFunction · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected