MCPcopy Index your code
hub / github.com/massCodeIO/massCode / getEntryNameValidationIssue

Function getEntryNameValidationIssue

src/shared/entryNameValidation.ts:62–93  ·  view source on GitHub ↗
(
  name: string,
)

Source from the content-addressed store, hash-verified

60}
61
62export function getEntryNameValidationIssue(
63 name: string,
64): EntryNameValidationIssue | null {
65 const normalizedName = normalizeEntryName(name)
66
67 if (!normalizedName || normalizedName === '.' || normalizedName === '..') {
68 return { code: 'empty' }
69 }
70
71 if (normalizedName.startsWith('.')) {
72 return { code: 'leadingDot' }
73 }
74
75 const invalidChars = findInvalidEntryNameChars(normalizedName)
76
77 if (invalidChars.length) {
78 return {
79 code: 'invalidChars',
80 chars: invalidChars,
81 }
82 }
83
84 if (normalizedName.endsWith('.')) {
85 return { code: 'trailingDot' }
86 }
87
88 if (WINDOWS_RESERVED_NAME_RE.test(normalizedName)) {
89 return { code: 'windowsReserved' }
90 }
91
92 return null
93}

Callers 4

saveCurrentRequestFunction · 0.90
sanitizeCaptureNameFunction · 0.90

Calls 2

normalizeEntryNameFunction · 0.85

Tested by

no test coverage detected