fix(core): recover reads with quote and accent variants (#50953)

This commit is contained in:
Aiden Cline
2026-09-23 14:02:31 -05:00
committed by GitHub
parent f51dc62721
commit b47824fb63
+7 -2
View File
@@ -135,9 +135,14 @@ export const Plugin = {
.pipe(Effect.orDie)
const alternatePath = Effect.fn("ReadTool.alternatePath")(function* (absolute: string) {
const base = basename(absolute).replace(/[\u00a0\u202f]/g, " ")
const canonical = (name: string) =>
name
.normalize("NFC")
.replace(/[\u00a0\u202f]/g, " ")
.replace(/[\u2018\u2019]/g, "'")
const base = canonical(basename(absolute))
const matches = (yield* reader.list(AbsolutePath.make(dirname(absolute)))).filter(
(entry) => entry.type === "file" && entry.name.replace(/[\u00a0\u202f]/g, " ") === base,
(entry) => entry.type === "file" && canonical(entry.name) === base,
)
if (matches.length !== 1) return
return join(dirname(absolute), matches[0].name)