Fixed assets path generation on windows (use server path for files where this is possible).

This commit is contained in:
Jan Böhmer 2020-06-07 19:25:58 +02:00
parent f089a16d74
commit bebe70d28e

View file

@ -87,12 +87,13 @@ class AttachmentURLGenerator
*/ */
public function absolutePathToAssetPath(string $absolute_path, ?string $public_path = null): ?string public function absolutePathToAssetPath(string $absolute_path, ?string $public_path = null): ?string
{ {
//Normalize file path (public path, use / as file path)
$absolute_path = str_replace('\\', '/', $absolute_path);
if (null === $public_path) { if (null === $public_path) {
$public_path = $this->public_path; $public_path = $this->public_path;
} }
//Our absolute path must begin with public path or we can not use it for asset pathes. //Our absolute path must begin with public path or we can not use it for asset pathes.
if (0 !== strpos($absolute_path, $public_path)) { if (0 !== strpos($absolute_path, $public_path)) {
return null; return null;