mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
enhance: force using StringComparison.Ordinal
This commit is contained in:
parent
cd2ecb109a
commit
f6eb1281b5
12 changed files with 23 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SourceGit.ViewModels {
|
||||
|
@ -19,7 +20,7 @@ namespace SourceGit.ViewModels {
|
|||
var expanded = changes.Count <= 50;
|
||||
|
||||
foreach (var c in changes) {
|
||||
var sepIdx = c.Path.IndexOf('/');
|
||||
var sepIdx = c.Path.IndexOf('/', StringComparison.Ordinal);
|
||||
if (sepIdx == -1) {
|
||||
nodes.Add(new FileTreeNode() {
|
||||
FullPath = c.Path,
|
||||
|
@ -80,7 +81,7 @@ namespace SourceGit.ViewModels {
|
|||
var expanded = files.Count <= 50;
|
||||
|
||||
foreach (var f in files) {
|
||||
var sepIdx = f.Path.IndexOf('/');
|
||||
var sepIdx = f.Path.IndexOf('/', StringComparison.Ordinal);
|
||||
if (sepIdx == -1) {
|
||||
nodes.Add(new FileTreeNode() {
|
||||
FullPath = f.Path,
|
||||
|
@ -139,7 +140,7 @@ namespace SourceGit.ViewModels {
|
|||
foreach (var node in nodes) {
|
||||
if (node.FullPath == path) return node;
|
||||
|
||||
if (node.IsFolder && path.StartsWith(node.FullPath + "/")) {
|
||||
if (node.IsFolder && path.StartsWith(node.FullPath + "/", StringComparison.Ordinal)) {
|
||||
var foundInChildren = SelectByPath(node.Children, path);
|
||||
if (foundInChildren != null) {
|
||||
node.IsExpanded = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue