File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ pub fn extract(
120120 source : & [ u8 ] ,
121121 ranges : & [ Range ] ,
122122) -> ( ) {
123- let path_str = format ! ( "{}" , path. display ( ) ) ;
123+ let path_str = normalize_path ( & path) ;
124124 let span = tracing:: span!(
125125 tracing:: Level :: TRACE ,
126126 "extract" ,
@@ -155,7 +155,7 @@ pub fn extract(
155155
156156/// Normalizes the path according the common CodeQL specification. Assumes that
157157/// `path` has already been canonicalized using `std::fs::canonicalize`.
158- fn normalize_path ( path : & Path ) -> String {
158+ pub fn normalize_path ( path : & Path ) -> String {
159159 if cfg ! ( windows) {
160160 // The way Rust canonicalizes paths doesn't match the CodeQL spec, so we
161161 // have to do a bit of work removing certain prefixes and replacing
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ fn main() -> std::io::Result<()> {
252252 "character-decoding-error" ,
253253 "Character decoding error" ,
254254 )
255- . file ( & path . to_string_lossy ( ) )
255+ . file ( & extractor :: normalize_path ( & path ) )
256256 . message (
257257 "Could not decode the file contents as {}: {}. The contents of the file must match the character encoding specified in the {} {}." ,
258258 & [
@@ -272,7 +272,7 @@ fn main() -> std::io::Result<()> {
272272 diagnostics_writer. write (
273273 diagnostics_writer
274274 . new_entry ( "unknown-character-encoding" , "Unknown character encoding" )
275- . file ( & path . to_string_lossy ( ) )
275+ . file ( & extractor :: normalize_path ( & path ) )
276276 . message (
277277 "Unknown character encoding {} in {} {}." ,
278278 & [
You can’t perform that action at this time.
0 commit comments