Skip to content

[Static analysis] Encodes a filename before inserting it into a URL. #120810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion clang/tools/scan-build/bin/scan-build
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@ ENDTEXT
}

# Emit the "View" link.
print OUT "<td><a href=\"$ReportFile#EndPath\">View Report</a></td>";
my $EncodedReport = URLEscape($ReportFile);
print OUT "<td><a href=\"$EncodedReport#EndPath\">View Report</a></td>";

# Emit REPORTBUG markers.
print OUT "\n<!-- REPORTBUG id=\"$ReportFile\" -->\n";
Expand Down Expand Up @@ -1465,6 +1466,16 @@ sub HtmlEscape {
return $tmp;
}

##----------------------------------------------------------------------------##
# URLEscape - encode characters that are special in URLs
##----------------------------------------------------------------------------##

sub URLEscape {
my $arg = shift || '';
$arg =~ s/\+/%2B/g;
return $arg;
}

##----------------------------------------------------------------------------##
# ShellEscape - backslash escape characters that are special to the shell
##----------------------------------------------------------------------------##
Expand Down
Loading