@@ -254,6 +254,61 @@ describe("resolveMarkdownFileLinkTarget", () => {
254254 } ) ;
255255 } ) ;
256256
257+ it ( "does not classify a case-distinct POSIX sibling as a workspace file" , ( ) => {
258+ expect (
259+ resolveMarkdownFileLinkMeta (
260+ "/tmp/t3code-case-test/project/probe.txt" ,
261+ "/tmp/t3code-case-test/Project" ,
262+ ) ,
263+ ) . toMatchObject ( {
264+ displayPath : "/tmp/t3code-case-test/project/probe.txt" ,
265+ workspaceRelativePath : null ,
266+ } ) ;
267+ } ) ;
268+
269+ it ( "keeps Windows workspace comparisons case-insensitive" , ( ) => {
270+ expect (
271+ resolveMarkdownFileLinkMeta ( "C:/Users/MIKE/Project/src/main.ts" , "c:/users/mike/project" ) ,
272+ ) . toMatchObject ( {
273+ displayPath : "project/src/main.ts" ,
274+ workspaceRelativePath : "src/main.ts" ,
275+ } ) ;
276+ } ) ;
277+
278+ it ( "keeps drive-root workspace comparisons case-insensitive" , ( ) => {
279+ expect ( resolveMarkdownFileLinkMeta ( "C:/Users/MIKE/project.ts" , "c:/" ) ) . toMatchObject ( {
280+ displayPath : "c:/Users/MIKE/project.ts" ,
281+ workspaceRelativePath : "Users/MIKE/project.ts" ,
282+ } ) ;
283+ } ) ;
284+
285+ it ( "keeps backslash UNC workspace comparisons case-insensitive" , ( ) => {
286+ expect (
287+ resolveMarkdownFileLinkMeta (
288+ "\\\\server\\share\\PROJECT\\src\\main.ts" ,
289+ "\\\\Server\\Share\\Project" ,
290+ ) ,
291+ ) . toMatchObject ( {
292+ displayPath : "Project/src/main.ts" ,
293+ workspaceRelativePath : "src/main.ts" ,
294+ } ) ;
295+ } ) ;
296+
297+ it . each ( [
298+ [ "/tmp/repo/file.ts" , "/" , "tmp/repo/file.ts" ] ,
299+ [ "C:/Users/MIKE/file.ts" , "c:/" , "Users/MIKE/file.ts" ] ,
300+ [ "\\\\server\\SHARE\\file.ts" , "\\\\Server\\Share\\" , "file.ts" ] ,
301+ [ "/tmp/repo/file.ts%20" , "/tmp/repo" , "file.ts " ] ,
302+ ] ) ( "preserves the preview target for %s in workspace %s" , ( href , cwd , workspaceRelativePath ) => {
303+ expect ( resolveMarkdownFileLinkMeta ( href , cwd ) ) . toMatchObject ( { workspaceRelativePath } ) ;
304+ } ) ;
305+
306+ it ( "keeps an encoded final space in the absolute target" , ( ) => {
307+ expect ( resolveMarkdownFileLinkTarget ( "/tmp/repo/file.ts%20" , "/tmp/repo" ) ) . toBe (
308+ "/tmp/repo/file.ts " ,
309+ ) ;
310+ } ) ;
311+
257312 it ( "normalizes slash-prefixed windows drive paths before resolving" , ( ) => {
258313 expect (
259314 resolveMarkdownFileLinkTarget (
0 commit comments