mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-16 17:28:41 +00:00
Pull out general functionality
This commit is contained in:
parent
9cdb79ca9b
commit
eac5fb4084
|
|
@ -69,8 +69,7 @@ final class ApiController extends Controller
|
||||||
$ids[] = $file->getId();
|
$ids[] = $file->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
$this->fillJsonRawResponse($request, $response, $ids);
|
||||||
$response->set($request->getUri()->__toString(), $ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -163,9 +162,15 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
private static function normalizeDbPath(string $path) : string
|
private static function normalizeDbPath(string $path) : string
|
||||||
{
|
{
|
||||||
|
$realpath = \realpath(__DIR__ . '/../../');
|
||||||
|
|
||||||
|
if ($realpath === false) {
|
||||||
|
throw new \Exception();
|
||||||
|
}
|
||||||
|
|
||||||
return \str_replace('\\', '/',
|
return \str_replace('\\', '/',
|
||||||
\str_replace(realpath(__DIR__ . '/../../'), '',
|
\str_replace($realpath, '',
|
||||||
rtrim($path, '/')
|
\rtrim($path, '/')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user