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(
120
120
source : & [ u8 ] ,
121
121
ranges : & [ Range ] ,
122
122
) -> ( ) {
123
- let path_str = format ! ( "{}" , path. display ( ) ) ;
123
+ let path_str = normalize_path ( & path) ;
124
124
let span = tracing:: span!(
125
125
tracing:: Level :: TRACE ,
126
126
"extract" ,
@@ -155,7 +155,7 @@ pub fn extract(
155
155
156
156
/// Normalizes the path according the common CodeQL specification. Assumes that
157
157
/// `path` has already been canonicalized using `std::fs::canonicalize`.
158
- fn normalize_path ( path : & Path ) -> String {
158
+ pub fn normalize_path ( path : & Path ) -> String {
159
159
if cfg ! ( windows) {
160
160
// The way Rust canonicalizes paths doesn't match the CodeQL spec, so we
161
161
// 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<()> {
252
252
"character-decoding-error" ,
253
253
"Character decoding error" ,
254
254
)
255
- . file ( & path . to_string_lossy ( ) )
255
+ . file ( & extractor :: normalize_path ( & path ) )
256
256
. message (
257
257
"Could not decode the file contents as {}: {}. The contents of the file must match the character encoding specified in the {} {}." ,
258
258
& [
@@ -272,7 +272,7 @@ fn main() -> std::io::Result<()> {
272
272
diagnostics_writer. write (
273
273
diagnostics_writer
274
274
. new_entry ( "unknown-character-encoding" , "Unknown character encoding" )
275
- . file ( & path . to_string_lossy ( ) )
275
+ . file ( & extractor :: normalize_path ( & path ) )
276
276
. message (
277
277
"Unknown character encoding {} in {} {}." ,
278
278
& [
You can’t perform that action at this time.
0 commit comments