File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1313 */
1414export function convertToMentionPath ( path : string , cwd ?: string ) : string {
1515 // Strip file:// protocol if present
16- const pathWithoutProtocol = path . startsWith ( "file://" ) ? path . substring ( 7 ) : path
16+ let pathWithoutProtocol = path . startsWith ( "file://" ) ? path . substring ( 7 ) : path
17+
18+ try {
19+ pathWithoutProtocol = decodeURIComponent ( pathWithoutProtocol )
20+ // Fix: Remove leading slash for Windows paths like /d:/...
21+ if ( pathWithoutProtocol . startsWith ( "/" ) && pathWithoutProtocol [ 2 ] === ":" ) {
22+ pathWithoutProtocol = pathWithoutProtocol . substring ( 1 )
23+ }
24+ } catch ( e ) {
25+ // Log error if decoding fails, but continue with the potentially problematic path
26+ console . error ( "Error decoding URI component in convertToMentionPath:" , e , pathWithoutProtocol )
27+ }
1728
1829 const normalizedPath = pathWithoutProtocol . replace ( / \\ / g, "/" )
1930 let normalizedCwd = cwd ? cwd . replace ( / \\ / g, "/" ) : ""
You can’t perform that action at this time.
0 commit comments