* Resolve a selected panorama picture to its file id. * * @param string $path * @return int * @throws \OCP\Files\NotFoundException * @throws \OCP\Files\NotPermittedException */
(string $path)
| 122 | * @throws \OCP\Files\NotPermittedException |
| 123 | */ |
| 124 | public function resolvePictureFile(string $path): int { |
| 125 | $path = ltrim($path, '/'); |
| 126 | if ($path === '') { |
| 127 | throw new \InvalidArgumentException('Picture path must not be empty'); |
| 128 | } |
| 129 | |
| 130 | $file = $this->rootFolder->getUserFolder($this->userId)->get($path); |
| 131 | if (!in_array($file->getMimeType(), self::PICTURE_MIME_TYPES, true)) { |
| 132 | throw new \InvalidArgumentException('Selected node is not a supported picture'); |
| 133 | } |
| 134 | |
| 135 | return (int)$file->getId(); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * check if own report |