mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 19:34:31 +02:00
Fixed assets path generation on windows (use server path for files where this is possible).
This commit is contained in:
parent
f089a16d74
commit
bebe70d28e
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue