mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Merge pull request #107 from webbuilders-group/image-path-rewrite-fix
BUGFIX: Fixed case where image urls could end up having a backslash on windows
This commit is contained in:
commit
5d28a93e9f
@ -238,16 +238,16 @@ class DocumentationParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite URL (relative or absolute)
|
// Rewrite URL (relative or absolute)
|
||||||
$baselink = DocumentationHelper::relativePath(
|
$baselink = DocumentationHelper::relativePath(DocumentationHelper::normalizePath(
|
||||||
dirname($page->getPath())
|
dirname($page->getPath())
|
||||||
);
|
));
|
||||||
|
|
||||||
// if the image starts with a slash, it's absolute
|
// if the image starts with a slash, it's absolute
|
||||||
if (substr($url, 0, 1) == '/') {
|
if (substr($url, 0, 1) == '/') {
|
||||||
$relativeUrl = str_replace(BASE_PATH, '', Controller::join_links(
|
$relativeUrl = DocumentationHelper::normalizePath(str_replace(BASE_PATH, '', Controller::join_links(
|
||||||
$page->getEntity()->getPath(),
|
$page->getEntity()->getPath(),
|
||||||
$url
|
$url
|
||||||
));
|
)));
|
||||||
} else {
|
} else {
|
||||||
$relativeUrl = rtrim($baselink, '/') . '/' . ltrim($url, '/');
|
$relativeUrl = rtrim($baselink, '/') . '/' . ltrim($url, '/');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user