File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,16 +186,35 @@ private function deleteSymlinkById($id) {
186186
187187 /**
188188 * @param \OCP\Files\FileInfo $node
189+ *
190+ * @return string
189191 */
190192 private function getNameFromNode ($ node ) {
191193 return $ node ->getName ();
192194 }
193195
194196 /**
195197 * @param \OCP\Files\FileInfo $node
198+ *
199+ * @return int
196200 */
197201 private function getStorageIdFromNode ($ node ) {
198- return $ node ->getStorage ()->getId ();
202+ $ storageId = $ node ->getStorage ()->getId ();
203+ $ query = $ this ->connection ->getQueryBuilder ();
204+ $ query ->select ('numeric_id ' )
205+ ->from ('storages ' )
206+ ->where ($ query ->expr ()->eq ('id ' , $ query ->createNamedParameter ($ storageId )));
207+ $ result = $ query ->executeQuery ();
208+
209+ if ($ result ->rowCount () > 1 ) {
210+ throw new \OCP \DB \Exception ("Storage (' $ storageId') is not unique in database! " );
211+ }
212+
213+ $ numericId = $ result ->fetchOne ();
214+ if ($ numericId === false ) {
215+ throw new \OCP \DB \Exception ("Unable to find storage ' $ storageId' in database! " );
216+ }
217+ return $ numericId ;
199218 }
200219
201220 /**
You can’t perform that action at this time.
0 commit comments