Skip to content

Commit cd1ca02

Browse files
committed
Move package:// translation after all other rules
Allows users to rewrite to package:// targets and still have the URI work.
1 parent 61c3c69 commit cd1ca02

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/JsonSchema/Uri/UriRetriever.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ class UriRetriever implements BaseUriRetrieverInterface
4444
*/
4545
private $schemaCache = array();
4646

47-
public function __construct()
48-
{
49-
// translate references to local files within the json-schema package
50-
$this->setTranslation('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')));
51-
}
52-
5347
/**
5448
* Guarantee the correct media type was encountered
5549
*
@@ -328,6 +322,9 @@ public function translate($uri)
328322
$uri = preg_replace($from, $to, $uri);
329323
}
330324

325+
// translate references to local files within the json-schema package
326+
$uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
327+
331328
return $uri;
332329
}
333330
}

0 commit comments

Comments
 (0)