File tree Expand file tree Collapse file tree
src/main/java/graphql/schema Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import graphql .Internal ;
66import graphql .normalized .ExecutableNormalizedField ;
77
8+ import java .io .File ;
89import java .nio .file .FileSystems ;
910import java .nio .file .Path ;
1011import java .nio .file .PathMatcher ;
3031public class DataFetchingFieldSelectionSetImpl implements DataFetchingFieldSelectionSet {
3132
3233 private final static String SEP = "/" ;
34+ private final static boolean UNIXY = SEP .equals (File .separator );
3335
3436 private final static DataFetchingFieldSelectionSet NOOP = new DataFetchingFieldSelectionSet () {
3537
@@ -110,6 +112,7 @@ public boolean contains(String fieldGlobPattern) {
110112 fieldGlobPattern = removeLeadingSlash (fieldGlobPattern );
111113 PathMatcher globMatcher = globMatcher (fieldGlobPattern );
112114 for (String flattenedField : flattenedFieldsForGlobSearching ) {
115+ flattenedField = osAppropriate (flattenedField );
113116 Path path = Paths .get (flattenedField );
114117 if (globMatcher .matches (path )) {
115118 return true ;
@@ -118,6 +121,14 @@ public boolean contains(String fieldGlobPattern) {
118121 return false ;
119122 }
120123
124+ private String osAppropriate (String flattenedField ) {
125+ if (UNIXY ) {
126+ return flattenedField ;
127+ } else {
128+ return flattenedField .replace (SEP , "\\ " );
129+ }
130+ }
131+
121132 @ Override
122133 public boolean containsAnyOf (String fieldGlobPattern , String ... fieldGlobPatterns ) {
123134 assertNotNull (fieldGlobPattern );
You can’t perform that action at this time.
0 commit comments