mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Ruby: skip non-existent files in overlay changes JSON
The previous implementation returned None if any of the paths in the changes JSON couldn't be canonicalized. This could happen for files that were deleted in the diff. Now, it just ignores paths for which canonicalize() fails.
This commit is contained in:
@@ -357,17 +357,15 @@ fn get_overlay_changed_files() -> Option<HashSet<PathBuf>> {
|
||||
// ...
|
||||
// ]
|
||||
// }
|
||||
json_value
|
||||
.get("changes")?
|
||||
.as_array()?
|
||||
.iter()
|
||||
.map(|change| {
|
||||
change
|
||||
.as_str()
|
||||
.map(|s| PathBuf::from(s).canonicalize().ok())
|
||||
.flatten()
|
||||
})
|
||||
.collect()
|
||||
Some(
|
||||
json_value
|
||||
.get("changes")?
|
||||
.as_array()?
|
||||
.iter()
|
||||
.filter_map(|change| change.as_str())
|
||||
.filter_map(|s| PathBuf::from(s).canonicalize().ok())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
fn scan_coding_comment(content: &[u8]) -> std::option::Option<Cow<str>> {
|
||||
|
||||
Reference in New Issue
Block a user