Skip to content

Commit 14ee996

Browse files
committed
fix(admin_audit): Fix incorrect truncation of files path in admin audit log
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 301f703 commit 14ee996

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

apps/admin_audit/lib/Actions/Files.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function read(BeforeNodeReadEvent $event): void {
3737
$node = $event->getNode();
3838
$params = [
3939
'id' => $node instanceof NonExistingFile ? null : $node->getId(),
40-
'path' => mb_substr($node->getInternalPath(), 5),
40+
'path' => $node->getPath(),
4141
];
4242
} catch (InvalidPathException|NotFoundException $e) {
4343
\OCP\Server::get(LoggerInterface::class)->error(
@@ -76,8 +76,8 @@ public function afterRename(NodeRenamedEvent $event): void {
7676
$originalSource = $this->renamedNodes[$target->getId()];
7777
$params = [
7878
'newid' => $target->getId(),
79-
'oldpath' => mb_substr($originalSource->getInternalPath(), 5),
80-
'newpath' => mb_substr($target->getInternalPath(), 5),
79+
'oldpath' => $originalSource->getPath(),
80+
'newpath' => $target->getPath(),
8181
];
8282
} catch (InvalidPathException|NotFoundException $e) {
8383
\OCP\Server::get(LoggerInterface::class)->error(
@@ -101,7 +101,7 @@ public function create(NodeCreatedEvent $event): void {
101101
try {
102102
$params = [
103103
'id' => $event->getNode()->getId(),
104-
'path' => mb_substr($event->getNode()->getInternalPath(), 5),
104+
'path' => $event->getNode()->getPath(),
105105
];
106106
} catch (InvalidPathException|NotFoundException $e) {
107107
\OCP\Server::get(LoggerInterface::class)->error(
@@ -127,8 +127,8 @@ public function copy(NodeCopiedEvent $event): void {
127127
$params = [
128128
'oldid' => $event->getSource()->getId(),
129129
'newid' => $event->getTarget()->getId(),
130-
'oldpath' => mb_substr($event->getSource()->getInternalPath(), 5),
131-
'newpath' => mb_substr($event->getTarget()->getInternalPath(), 5),
130+
'oldpath' => $event->getSource()->getPath(),
131+
'newpath' => $event->getTarget()->getPath(),
132132
];
133133
} catch (InvalidPathException|NotFoundException $e) {
134134
\OCP\Server::get(LoggerInterface::class)->error(
@@ -151,7 +151,7 @@ public function write(NodeWrittenEvent $event): void {
151151
try {
152152
$params = [
153153
'id' => $node->getId(),
154-
'path' => mb_substr($node->getInternalPath(), 5),
154+
'path' => $node->getPath(),
155155
];
156156
} catch (InvalidPathException|NotFoundException $e) {
157157
\OCP\Server::get(LoggerInterface::class)->error(
@@ -177,7 +177,7 @@ public function delete(BeforeNodeDeletedEvent $event): void {
177177
try {
178178
$params = [
179179
'id' => $event->getNode()->getId(),
180-
'path' => mb_substr($event->getNode()->getInternalPath(), 5),
180+
'path' => $event->getNode()->getPath(),
181181
];
182182
} catch (InvalidPathException|NotFoundException $e) {
183183
\OCP\Server::get(LoggerInterface::class)->error(
@@ -206,7 +206,7 @@ public function preview(BeforePreviewFetchedEvent $event): void {
206206
'height' => $event->getHeight(),
207207
'crop' => $event->isCrop(),
208208
'mode' => $event->getMode(),
209-
'path' => mb_substr($file->getInternalPath(), 5)
209+
'path' => $file->gelPath(),
210210
];
211211
} catch (InvalidPathException|NotFoundException $e) {
212212
\OCP\Server::get(LoggerInterface::class)->error(

0 commit comments

Comments
 (0)