@@ -19,6 +19,7 @@ trait WebDav {
1919 /** @var int */
2020 private $ storedFileID = null ;
2121 private array $ trashedFiles = [];
22+ protected array $ lastShareData = [];
2223
2324 /**
2425 * @Given /^using dav path "([^"]*)"$/
@@ -140,7 +141,7 @@ public function downloadFileWithRange($fileSource, $range) {
140141 * @param string $range
141142 */
142143 public function downloadPublicFileWithRange ($ range ) {
143- $ token = $ this ->lastShareData -> data -> token ;
144+ $ token = $ this ->lastShareData [ ' token ' ] ;
144145 $ fullUrl = $ this ->baseUrl . 'public.php/webdav ' ;
145146
146147 $ client = new GClient ();
@@ -150,15 +151,19 @@ public function downloadPublicFileWithRange($range) {
150151 'Range ' => $ range
151152 ];
152153
153- $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
154+ try {
155+ $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
156+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
157+ $ this ->response = $ e ->getResponse ();
158+ }
154159 }
155160
156161 /**
157162 * @When /^Downloading last public shared file inside a folder "([^"]*)" with range "([^"]*)"$/
158163 * @param string $range
159164 */
160165 public function downloadPublicFileInsideAFolderWithRange ($ path , $ range ) {
161- $ token = $ this ->lastShareData -> data -> token ;
166+ $ token = $ this ->lastShareData [ ' token ' ] ;
162167 $ fullUrl = $ this ->baseUrl . 'public.php/webdav ' . "$ path " ;
163168
164169 $ client = new GClient ();
@@ -169,7 +174,11 @@ public function downloadPublicFileInsideAFolderWithRange($path, $range) {
169174 ];
170175 $ options ['auth ' ] = [$ token , '' ];
171176
172- $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
177+ try {
178+ $ this ->response = $ client ->request ('GET ' , $ fullUrl , $ options );
179+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
180+ $ this ->response = $ e ->getResponse ();
181+ }
173182 }
174183
175184 /**
@@ -189,8 +198,13 @@ public function downloadedContentShouldBe($content) {
189198 */
190199 public function checkPropForFile ($ file , $ prefix , $ prop , $ value ) {
191200 $ elementList = $ this ->propfindFile ($ this ->currentUser , $ file , "< $ prefix: $ prop/> " );
192- $ property = $ elementList ['/ ' . $ this ->getDavFilesPath ($ this ->currentUser ) . $ file ][200 ]["{DAV:} $ prop " ];
193- Assert::assertEquals ($ property , $ value );
201+ if ($ prefix === 'oc ' ) {
202+ $ prefix = '{http://owncloud.org/ns} ' ;
203+ } else {
204+ $ prefix = '{DAV:} ' ;
205+ }
206+ $ property = $ elementList ['/ ' . $ this ->getDavFilesPath ($ this ->currentUser ) . $ file ][200 ]["$ prefix$ prop " ];
207+ Assert::assertEquals ($ value , $ property );
194208 }
195209
196210 /**
0 commit comments