@@ -91,12 +91,14 @@ private function retrieveRepeatableFiles(Model $entry): Model
9191 if ($ this ->isRelationship ) {
9292 return $ this ->retrieveFiles ($ entry );
9393 }
94+
95+ $ repeatableUploaders = app ('UploadersRepository ' )->getRepeatableUploadersFor ($ this ->getRepeatableContainerName ());
96+
9497 $ values = $ entry ->{$ this ->getRepeatableContainerName ()};
9598 $ values = is_string ($ values ) ? json_decode ($ values , true ) : $ values ;
96- $ repeatableUploaders = app ('UploadersRepository ' )->getRepeatableUploadersFor ($ this ->getRepeatableContainerName ());
9799 $ values = array_map (function ($ item ) use ($ repeatableUploaders ) {
98100 foreach ($ repeatableUploaders as $ upload ) {
99- $ item [$ upload ->getName ()] = isset ( $ item [ $ upload -> getName ()]) ? Str:: after ( $ item[ $ upload -> getName ()] , $ upload-> getPath ()) : null ;
101+ $ item [$ upload ->getName ()] = $ this -> getValuesWithPathStripped ( $ item , $ upload) ;
100102 }
101103
102104 return $ item ;
@@ -185,4 +187,14 @@ private function getPreviousRepeatableValues(Model $entry, UploaderInterface $up
185187
186188 return $ previousValues ?? [];
187189 }
190+
191+ private function getValuesWithPathStripped (array |string |null $ item , UploaderInterface $ upload ) {
192+ $ uploadedValues = $ item [$ upload ->getName ()] ?? null ;
193+ if (is_array ($ uploadedValues )) {
194+ return array_map (function ($ value ) use ($ upload ) {
195+ return Str::after ($ value , $ upload ->getPath ());
196+ },$ uploadedValues );
197+ }
198+ return isset ($ uploadedValues ) ? Str::after ($ uploadedValues , $ upload ->getPath ()) : null ;
199+ }
188200}
0 commit comments