image: revert filename format change
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/803/head
parent
cd853f4a04
commit
ff481dffbb
|
@ -204,12 +204,11 @@ class ImageController extends GenericApiController
|
|||
// Allow these ony for logged in users
|
||||
$user = $this->userSession->getUser();
|
||||
if (null !== $user) {
|
||||
{ // Get the path of the file if in current user's files
|
||||
$path = $file->getPath();
|
||||
$parts = explode('/', $path);
|
||||
if (\count($parts) > 3 && $parts[1] === $user->getUID()) {
|
||||
$info['filename'] = $path;
|
||||
}
|
||||
// Get the path of the file relative to current user
|
||||
// "/admin/files/Photos/Camera/20230821_135017.jpg" => "/Photos/..."
|
||||
$parts = explode('/', $file->getPath());
|
||||
if (\count($parts) > 3 && 'files' === $parts[2] && $parts[1] === $user->getUID()) {
|
||||
$info['filename'] = '/'.implode('/', \array_slice($parts, 3));
|
||||
}
|
||||
|
||||
// Get list of tags for this file
|
||||
|
|
|
@ -299,7 +299,7 @@ export default defineComponent({
|
|||
/** Image info */
|
||||
imageInfoTitle(): string | null {
|
||||
if (this.config.sidebar_filepath && this.filepath) {
|
||||
return this.filepath;
|
||||
return this.filepath.replace(/^\//, ''); // remove leading slash
|
||||
}
|
||||
|
||||
return this.baseInfo.basename;
|
||||
|
@ -307,12 +307,7 @@ export default defineComponent({
|
|||
|
||||
/** Path to file excluding user directory */
|
||||
filepath(): string | null {
|
||||
if (utils.truthy(this.baseInfo, 'filename')) {
|
||||
// "/admin/files/Photos/Camera/20230821_135017.jpg" => "Photos/..."
|
||||
return this.baseInfo.filename.split('/').slice(3).join('/');
|
||||
}
|
||||
|
||||
return null;
|
||||
return this.baseInfo?.filename ?? null;
|
||||
},
|
||||
|
||||
imageInfoSub(): string[] {
|
||||
|
|
Loading…
Reference in New Issue