The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 23:30 UTC
fix(shared): keep spreadsheet shorthand as inline code (#23203)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 01:58 UTC
9ef52de2930782e413ca9d2b5fef7500496d7123
2 files changed
+19
-1
packages/shared/src/markdownLinks.test.ts
+7
@@ -40,6 +40,13 @@ describe("inlineCodeFilePathCandidate", () => {
40
["/tmp/.../scratchpad/notes.md", null],
41
["~/projects/…/notes.md", null],
42
["src/.../main.ts", null],
43
+ // regression: #22181 a `:line` suffix does not make an extensionless basename a file
44
+ ["I/W217:220", null],
45
+ ["bin/run:12", null],
46
+ ["docs/README:12", "docs/README:12"],
47
+ ["./bin/run:12", "./bin/run:12"],
48
+ ["src/資料.備份:12", "src/資料.備份:12"],
49
+ ["src/foo.c++:12", "src/foo.c++:12"],
50
])("distinguishes file paths from code and hostnames in %s", (source, candidate) => {
51
expect(inlineCodeFilePathCandidate(source)).toBe(candidate);
52
});
packages/shared/src/markdownLinks.ts
+12
-1
@@ -37,6 +37,7 @@ const PATH_SEPARATOR_PATTERN = /[\\/]/;
37
const ELIDED_PATH_SEGMENT_PATTERN = /(?:^|[\\/])(?:\.{3,}|…)(?:[\\/]|$)/;
38
39
const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;
40
+const ANY_FILE_EXTENSION_PATTERN = /\.[^./\\]+$/;
41
const VERSION_SUFFIX_PATTERN = /\d\.\d[^.]*$/;
42
const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/;
43
@@ -200,7 +201,17 @@ export function inlineCodeFilePathCandidate(codeText: string): string | null {
201
.split(/[\\/]/)
202
.at(-1) ?? "";
203
if (VERSION_SUFFIX_PATTERN.test(basename)) return null;
203
- if (!hasPosition && !FILE_EXTENSION_PATTERN.test(basename)) return null;
204
+ if (!FILE_EXTENSION_PATTERN.test(basename)) {
205
+ if (!hasPosition) return null;
206
+ // A `:line` suffix alone does not make `I/W217:220` a file reference.
207
+ if (
208
+ withoutPosition.includes("/") &&
209
+ !ANY_FILE_EXTENSION_PATTERN.test(basename) &&
210
+ !EXTENSIONLESS_FILE_NAMES.has(basename)
211
+ ) {
212
+ return null;
213
+ }
214
+ }
215
}
216
return candidate;
217
}