@@ -171,14 +171,36 @@ protected function throwIfFileNotFound(): void {
171171 $ signRequest = $ this ->identifyService ->getSignRequestMapper ()->getById ($ this ->getEntity ()->getSignRequestId ());
172172 $ fileEntity = $ this ->identifyService ->getFileMapper ()->getById ($ signRequest ->getFileId ());
173173
174- $ nodeId = $ fileEntity ->getNodeId ();
174+ $ filesToCheck = [];
175+
176+ if ($ fileEntity ->getNodeType () === 'envelope ' ) {
177+ $ children = $ this ->identifyService ->getFileMapper ()->getChildrenFiles ($ fileEntity ->getId ());
178+ foreach ($ children as $ child ) {
179+ $ filesToCheck [] = [
180+ 'nodeId ' => $ child ->getNodeId (),
181+ 'userId ' => $ child ->getUserId (),
182+ 'name ' => $ child ->getName (),
183+ ];
184+ }
185+ } else {
186+ $ filesToCheck [] = [
187+ 'nodeId ' => $ fileEntity ->getNodeId (),
188+ 'userId ' => $ fileEntity ->getUserId (),
189+ 'name ' => $ fileEntity ->getName (),
190+ ];
191+ }
175192
176- $ fileToSign = $ this ->identifyService ->getRootFolder ()->getUserFolder ($ fileEntity ->getUserId ())->getFirstNodeById ($ nodeId );
177- if (!$ fileToSign instanceof \OCP \Files \File) {
178- throw new LibresignException (json_encode ([
179- 'action ' => JSActions::ACTION_DO_NOTHING ,
180- 'errors ' => [['message ' => $ this ->identifyService ->getL10n ()->t ('File not found ' )]],
181- ]));
193+ foreach ($ filesToCheck as $ fileInfo ) {
194+ $ fileToSign = $ this ->identifyService ->getRootFolder ()
195+ ->getUserFolder ($ fileInfo ['userId ' ])
196+ ->getFirstNodeById ($ fileInfo ['nodeId ' ]);
197+
198+ if (!$ fileToSign instanceof \OCP \Files \File) {
199+ throw new LibresignException (json_encode ([
200+ 'action ' => JSActions::ACTION_DO_NOTHING ,
201+ 'errors ' => [['message ' => $ this ->identifyService ->getL10n ()->t ('File not found ' )]],
202+ ]));
203+ }
182204 }
183205 }
184206
0 commit comments