File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
extensions/ql-vscode/src/pure Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,18 @@ export function tryGetRemoteLocation(
111111 // "file:${sourceLocationPrefix}/relative/path/to/file"
112112 // So we need to strip off the first part to get the relative path.
113113 if ( sourceLocationPrefix ) {
114+ if ( ! resolvableLocation . uri . startsWith ( `file:${ sourceLocationPrefix } /` ) ) {
115+ return undefined ;
116+ }
114117 trimmedLocation = resolvableLocation . uri . replace ( `file:${ sourceLocationPrefix } /` , '' ) ;
115118 } else {
116119 // If the source location prefix is empty (e.g. for older remote queries), we assume that the database
117120 // was created on a Linux actions runner and has the format:
118- // "file:/home/runner/work/<repo>/<repo/relative/path/to/file"
121+ // "file:/home/runner/work/<repo>/<repo> /relative/path/to/file"
119122 // So we need to drop the first 6 parts of the path.
123+ if ( ! resolvableLocation . uri . startsWith ( 'file:/home/runner/work/' ) ) {
124+ return undefined ;
125+ }
120126 const locationParts = resolvableLocation . uri . split ( '/' ) ;
121127 trimmedLocation = locationParts . slice ( 6 , locationParts . length ) . join ( '/' ) ;
122128 }
You can’t perform that action at this time.
0 commit comments