Remove leading slash from sharing activity

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-12-15 15:53:48 +01:00
parent 3714a6aaf0
commit 6de0eb0b74
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
9 changed files with 13 additions and 11 deletions

View File

@ -206,7 +206,7 @@ class Provider implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -142,10 +142,11 @@ class FavoriteProvider implements IProvider {
'type' => 'file',
'id' => $event->getObjectId(),
'name' => basename($event->getObjectName()),
'path' => $event->getObjectName(),
'path' => trim($event->getObjectName(), '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $event->getObjectId()]),
];
$event->setParsedSubject(str_replace('{file}', trim($parameter['path'], '/'), $subject))
$event->setParsedSubject(str_replace('{file}', $parameter['path'], $subject))
->setRichSubject($subject, ['file' => $parameter]);
}
}

View File

@ -201,7 +201,7 @@ class Provider implements IProvider {
foreach ($parameters as $placeholder => $parameter) {
$placeholders[] = '{' . $placeholder . '}';
if ($parameter['type'] === 'file') {
$replacements[] = trim($parameter['path'], '/');
$replacements[] = $parameter['path'];
} else {
$replacements[] = $parameter['name'];
}
@ -253,7 +253,8 @@ class Provider implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -187,7 +187,7 @@ class Downloads implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -232,7 +232,7 @@ class Groups implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -239,7 +239,7 @@ class PublicLinks implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -260,7 +260,7 @@ class Users implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -196,7 +196,7 @@ class Activity implements IProvider {
'type' => 'file',
'id' => $id,
'name' => basename($path),
'path' => $path,
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),
];
}

View File

@ -191,7 +191,7 @@ class Definitions {
'path' => [
'since' => '11.0.0',
'required' => true,
'description' => 'The full path of the file for the user',
'description' => 'The full path of the file for the user, should not start with a slash',
'example' => 'path/to/file.txt',
],
'link' => [