mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-01-03 23:42:28 +03:00
Fixed issue with translation loading without theme
System was using the empty state return from theme_path, when no theme was configured, for loading in languages which would result in the root path being looked up upon. This changes the theme_path helper to return null in cases a theme is not configured instead of empty string to help prevent assumed return path will be legitimate, and to help enforce error case handling. For #2836
This commit is contained in:
@@ -94,13 +94,15 @@ function setting(string $key = null, $default = null)
|
||||
|
||||
/**
|
||||
* Get a path to a theme resource.
|
||||
* Returns null if a theme is not configured and
|
||||
* therefore a full path is not available for use.
|
||||
*/
|
||||
function theme_path(string $path = ''): string
|
||||
function theme_path(string $path = ''): ?string
|
||||
{
|
||||
$theme = config('view.theme');
|
||||
|
||||
if (!$theme) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
return base_path('themes/' . $theme .($path ? DIRECTORY_SEPARATOR.$path : $path));
|
||||
|
||||
Reference in New Issue
Block a user