Skip to content

Fix location links being displayed for query results with empty file:/// URI - #4357

Open
Marcono1234 wants to merge 1 commit into
github:mainfrom
Marcono1234:empty-file-uri
Open

Fix location links being displayed for query results with empty file:/// URI#4357
Marcono1234 wants to merge 1 commit into
github:mainfrom
Marcono1234:empty-file-uri

Conversation

@Marcono1234

@Marcono1234 Marcono1234 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

At least on Windows 11 when running a query for a folder-based database or generating the AST view, the results contained a file:/// instead of a file:/ URI for elements without location.
But previously the code only considered file:/ to be "empty".

Previous behavior

  • AST view: clicking on a node without location lead to a verbose error like "... Unable to read file 'codeql-zip-archive://...\database\src.zip' that is actually a directory"
  • Query results view showed the results as blue and clickable, but clicking them did nothing

Example

For example, generating a CodeQL database for this Java snippet (>= Java 21) and then creating the AST or querying for the PrintAst.qll LocalVarDeclSynthNode class has "(Pattern case declaration)" results without location.

class Test {
    int m(Integer o) {
        return switch (o) {
            case Integer i when i % 2 == 0 -> 2;
            case 1 -> 1;
            case null -> throw new IllegalArgumentException();
            default -> 4;
        };
    }
}
@Marcono1234
Marcono1234 requested a review from a team as a code owner April 3, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant