Skip to content

Commit c1a016f

Browse files
committed
Improved the logic for the "IsImagePickerEditor" method
1 parent a749bd9 commit c1a016f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Skybrud.ImagePicker/Grid/Converters/ImagePickerGridConverter.cs

+7-9
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,15 @@ public override bool GetControlWrapper(GridControl control, out GridControlWrapp
5555
}
5656

5757
private bool IsImagePickerEditor(GridEditor editor) {
58-
const string alias = "skybrud.imagepicker";
59-
const string view = "/app_plugins/skybrud.imagepicker/views/imagepickergrideditor.html";
60-
return ContainsIgnoreCase(editor.View, view) || EqualsIgnoreCase(editor.Alias, alias) || ContainsIgnoreCase(editor.Alias, alias + ".");
61-
}
6258

63-
private bool ContainsIgnoreCase(string source, string value) {
64-
return CultureInfo.InvariantCulture.CompareInfo.IndexOf(source, value, CompareOptions.IgnoreCase) >= 0;
65-
}
59+
// The editor may be NULL if it no longer exists in a package.manifest file
60+
if (editor == null) return false;
61+
62+
const string alias = "Skybrud.ImagePicker";
63+
const string view = "/App_Plugins/Skybrud.ImagePicker/views/ImagePickerGridEditor.html";
64+
65+
return ContainsIgnoreCase(editor.View.Split('?')[0], view) || EqualsIgnoreCase(editor.Alias, alias) || ContainsIgnoreCase(editor.Alias, alias + ".");
6666

67-
private bool EqualsIgnoreCase(string source, string value) {
68-
return source != null && source.Equals(value, StringComparison.InvariantCultureIgnoreCase);
6967
}
7068

7169
}

0 commit comments

Comments
 (0)