mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00: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;
|
if($urlParts && isset($urlParts['scheme'])) continue;
|
||||||
|
|
||||||
// Rewrite URL (relative or absolute)
|
// Rewrite URL (relative or absolute)
|
||||||
$baselink = Director::makeRelative(dirname($page->getPath()));
|
$baselink = Director::makeRelative(dirname($page->getPath(false, false)));
|
||||||
$relativeUrl = rtrim($baselink, '/') . '/' . ltrim($url, '/');
|
$relativeUrl = rtrim($baselink, '/') . '/' . ltrim($url, '/');
|
||||||
|
|
||||||
// Resolve relative paths
|
// Resolve relative paths
|
||||||
|
@ -100,15 +100,14 @@ class DocumentationPage extends ViewableData {
|
|||||||
* will return the path of the first file in the folder
|
* will return the path of the first file in the folder
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getPath($defaultFile = false) {
|
function getPath($defaultFile = false, $realpath = true) {
|
||||||
if($this->entity) {
|
if($this->entity) {
|
||||||
|
|
||||||
$path = Controller::join_links(
|
$path = Controller::join_links(
|
||||||
$this->entity->getPath($this->getVersion(), $this->lang),
|
$this->entity->getPath($this->getVersion(), $this->lang),
|
||||||
$this->getRelativePath()
|
$this->getRelativePath()
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!is_dir($path)) $path = realpath($path);
|
if(!is_dir($path) && $realpath) $path = realpath($path);
|
||||||
else if($defaultFile) {
|
else if($defaultFile) {
|
||||||
$file = DocumentationService::find_page($this->entity, explode('/', $this->getRelativePath()));
|
$file = DocumentationService::find_page($this->entity, explode('/', $this->getRelativePath()));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user