mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Allow symlinks in repo locations (don't resolve on image src)
This commit is contained in:
parent
9a84f674b8
commit
6227e1eb68
@ -193,7 +193,7 @@ class DocumentationParser {
|
||||
if($urlParts && isset($urlParts['scheme'])) continue;
|
||||
|
||||
// Rewrite URL (relative or absolute)
|
||||
$baselink = Director::makeRelative(dirname($page->getPath()));
|
||||
$baselink = Director::makeRelative(dirname($page->getPath(false, false)));
|
||||
$relativeUrl = rtrim($baselink, '/') . '/' . ltrim($url, '/');
|
||||
|
||||
// Resolve relative paths
|
||||
|
@ -100,15 +100,14 @@ class DocumentationPage extends ViewableData {
|
||||
* will return the path of the first file in the folder
|
||||
* @return string
|
||||
*/
|
||||
function getPath($defaultFile = false) {
|
||||
function getPath($defaultFile = false, $realpath = true) {
|
||||
if($this->entity) {
|
||||
|
||||
$path = Controller::join_links(
|
||||
$this->entity->getPath($this->getVersion(), $this->lang),
|
||||
$this->getRelativePath()
|
||||
);
|
||||
|
||||
if(!is_dir($path)) $path = realpath($path);
|
||||
if(!is_dir($path) && $realpath) $path = realpath($path);
|
||||
else if($defaultFile) {
|
||||
$file = DocumentationService::find_page($this->entity, explode('/', $this->getRelativePath()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user