File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class UriRetriever
29
29
*
30
30
* @throws InvalidSchemaMediaTypeException
31
31
*/
32
- public function confirmMediaType ($ uriRetriever )
32
+ public function confirmMediaType ($ uriRetriever, $ uri )
33
33
{
34
34
$ contentType = $ uriRetriever ->getContentType ();
35
35
@@ -42,6 +42,11 @@ public function confirmMediaType($uriRetriever)
42
42
return ;
43
43
}
44
44
45
+ if (substr ($ uri , 0 , 23 ) == 'http://json-schema.org/ ' ) {
46
+ //HACK; they deliver broken content types
47
+ return true ;
48
+ }
49
+
45
50
throw new InvalidSchemaMediaTypeException (sprintf ('Media type %s expected ' , Validator::SCHEMA_MEDIA_TYPE ));
46
51
}
47
52
@@ -131,7 +136,7 @@ public function retrieve($uri, $baseUri = null)
131
136
132
137
$ uriRetriever = $ this ->getUriRetriever ();
133
138
$ contents = $ this ->uriRetriever ->retrieve ($ fetchUri );
134
- $ this ->confirmMediaType ($ uriRetriever );
139
+ $ this ->confirmMediaType ($ uriRetriever, $ fetchUri );
135
140
$ jsonSchema = json_decode ($ contents );
136
141
137
142
if (JSON_ERROR_NONE < $ error = json_last_error ()) {
You can’t perform that action at this time.
0 commit comments