diff --git a/apps/files/lib/Sharing/Source/NodeShareSourceType.php b/apps/files/lib/Sharing/Source/NodeShareSourceType.php index 3ebf9cd1626ec..cabaaf2089f18 100644 --- a/apps/files/lib/Sharing/Source/NodeShareSourceType.php +++ b/apps/files/lib/Sharing/Source/NodeShareSourceType.php @@ -57,6 +57,10 @@ public function getDisplayName(IFactory $l10nFactory): string { #[\Override] public function validateSource(string $source): bool { + if ((string)(int)$source !== $source) { + return false; + } + return $this->rootFolder->getFirstNodeById((int)$source) instanceof Node; } diff --git a/apps/files/tests/Sharing/Source/NodeShareSourceTypeTest.php b/apps/files/tests/Sharing/Source/NodeShareSourceTypeTest.php index bb04d80af93a3..5b94af3e8dc7b 100644 --- a/apps/files/tests/Sharing/Source/NodeShareSourceTypeTest.php +++ b/apps/files/tests/Sharing/Source/NodeShareSourceTypeTest.php @@ -77,6 +77,9 @@ protected function tearDown(): void { public function testValidateSource(): void { $this->assertTrue($this->sourceType->validateSource((string)$this->node->getId())); $this->assertFalse($this->sourceType->validateSource('-1')); + $this->assertFalse($this->sourceType->validateSource('000123')); + $this->assertFalse($this->sourceType->validateSource('123abcdef')); + $this->assertFalse($this->sourceType->validateSource('000123abcdef')); } public function testGetSourceDisplayName(): void {