@@ -53,24 +53,7 @@ func splitKeyValue(input string) (sep rune, sepLen int, k, v string, ok bool) {
5353 return sep , sepLen , k , v , true
5454}
5555
56- func normalizePathRestrictAccessesAccurate (inputs []string , normalizePath func (string ) string ) map [string ][]string {
57- maps := make (map [string ][]string , len (inputs ))
58-
59- for i := range inputs {
60- reqPath , hosts , ok := splitKeyValues (inputs [i ])
61- if ! ok {
62- continue
63- }
64-
65- normalizedPath := normalizePath (reqPath )
66- normalizedHosts := util .ExtractHostsFromUrls (hosts )
67- maps [normalizedPath ] = append (maps [normalizedPath ], normalizedHosts ... )
68- }
69-
70- return maps
71- }
72-
73- func normalizePathRestrictAccessesNoCase (inputs []string , normalizePath func (string ) string ) map [string ][]string {
56+ func normalizePathRestrictAccesses (inputs []string , normalizePath func (string ) string ) map [string ][]string {
7457 maps := make (map [string ][]string , len (inputs ))
7558
7659 for i := range inputs {
@@ -83,7 +66,7 @@ func normalizePathRestrictAccessesNoCase(inputs []string, normalizePath func(str
8366 normalizedHosts := util .ExtractHostsFromUrls (hosts )
8467
8568 for existingPath := range maps {
86- if strings . EqualFold (existingPath , normalizedPath ) {
69+ if util . IsPathEqual (existingPath , normalizedPath ) {
8770 normalizedPath = existingPath
8871 break
8972 }
@@ -95,29 +78,7 @@ func normalizePathRestrictAccessesNoCase(inputs []string, normalizePath func(str
9578 return maps
9679}
9780
98- func normalizePathHeadersMapAccurate (inputs []string , normalizePath func (string ) string ) map [string ][][2 ]string {
99- maps := make (map [string ][][2 ]string , len (inputs ))
100-
101- for _ , input := range inputs {
102- sep , sepLen , reqPath , header , ok := splitKeyValue (input )
103- if ! ok {
104- continue
105- }
106- sepIndex := strings .IndexRune (header , sep )
107- if sepIndex <= 0 || sepIndex + sepLen == len (header ) {
108- continue
109- }
110-
111- normalizedPath := normalizePath (reqPath )
112- headerName := header [:sepIndex ]
113- headerValue := header [sepIndex + 1 :]
114- maps [normalizedPath ] = append (maps [normalizedPath ], [2 ]string {headerName , headerValue })
115- }
116-
117- return maps
118- }
119-
120- func normalizePathHeadersMapNoCase (inputs []string , normalizePath func (string ) string ) map [string ][][2 ]string {
81+ func normalizePathHeadersMap (inputs []string , normalizePath func (string ) string ) map [string ][][2 ]string {
12182 maps := make (map [string ][][2 ]string , len (inputs ))
12283
12384 for _ , input := range inputs {
@@ -135,7 +96,7 @@ func normalizePathHeadersMapNoCase(inputs []string, normalizePath func(string) s
13596 headerValue := header [sepIndex + 1 :]
13697
13798 for existingPath := range maps {
138- if strings . EqualFold (existingPath , normalizedPath ) {
99+ if util . IsPathEqual (existingPath , normalizedPath ) {
139100 normalizedPath = existingPath
140101 break
141102 }
@@ -147,24 +108,7 @@ func normalizePathHeadersMapNoCase(inputs []string, normalizePath func(string) s
147108 return maps
148109}
149110
150- func normalizePathMapsAccurate (inputs []string ) map [string ]string {
151- maps := make (map [string ]string , len (inputs ))
152-
153- for _ , input := range inputs {
154- _ , _ , urlPath , fsPath , ok := splitKeyValue (input )
155- if ! ok {
156- continue
157- }
158-
159- urlPath = util .CleanUrlPath (urlPath )
160- fsPath = filepath .Clean (fsPath )
161- maps [urlPath ] = fsPath
162- }
163-
164- return maps
165- }
166-
167- func normalizePathMapsNoCase (inputs []string ) map [string ]string {
111+ func normalizePathMaps (inputs []string ) map [string ]string {
168112 maps := make (map [string ]string , len (inputs ))
169113
170114 for _ , input := range inputs {
@@ -177,7 +121,7 @@ func normalizePathMapsNoCase(inputs []string) map[string]string {
177121 fsPath = filepath .Clean (fsPath )
178122
179123 for existingUrl := range maps {
180- if strings . EqualFold (existingUrl , urlPath ) {
124+ if util . IsPathEqual (existingUrl , urlPath ) {
181125 urlPath = existingUrl
182126 break
183127 }
0 commit comments