File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -214,8 +214,8 @@ def __call__(self, value: str) -> str:
214214
215215 # Hostname is optional for file URLS. If absent it means `localhost`.
216216 # Fill it in for the validation if needed
217- if scheme == "file" and value .startswith ("file:///" ):
218- matched = regex .search (value . replace ( "file:///" , "file:// localhost/", 1 ) )
217+ if scheme == "file" and value .lower (). startswith ("file:///" ):
218+ matched = regex .search ("file://localhost/" + value [ 8 :] )
219219 else :
220220 matched = regex .search (value )
221221
Original file line number Diff line number Diff line change @@ -224,6 +224,14 @@ def test_url_custom_scheme_case_insensitive():
224224 "file:///tmp/test%20file.txt" ,
225225 "file:///" ,
226226 "file://localhost/" ,
227+ "FILE:///tmp/tmp1234" ,
228+ "FILE://localhost/tmp/tmp1234" ,
229+ "FILE:///C:/Users/test/file.txt" ,
230+ "FILE://localhost/C:/Program%20Files/file.exe" ,
231+ "FILE:///home/user/documents/test.pdf" ,
232+ "FILE:///tmp/test%20file.txt" ,
233+ "FILE:///" ,
234+ "FILE://localhost/" ,
227235 ),
228236)
229237def test_url_accepts_valid_file_urls (valid_url ):
You can’t perform that action at this time.
0 commit comments