Skip to content

Commit

Permalink
Move package:// translation after all other rules
Browse files Browse the repository at this point in the history
Allows users to rewrite to package:// targets and still have the URI
work.
  • Loading branch information
erayd committed Feb 24, 2017
1 parent 61c3c69 commit cd1ca02
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/JsonSchema/Uri/UriRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class UriRetriever implements BaseUriRetrieverInterface
*/
private $schemaCache = array();

public function __construct()
{
// translate references to local files within the json-schema package
$this->setTranslation('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')));
}

/**
* Guarantee the correct media type was encountered
*
Expand Down Expand Up @@ -328,6 +322,9 @@ public function translate($uri)
$uri = preg_replace($from, $to, $uri);
}

// translate references to local files within the json-schema package
$uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);

return $uri;
}
}

0 comments on commit cd1ca02

Please sign in to comment.