@@ -79,39 +79,10 @@ public function serveProtectedAssetPathAction(Request $request, int $id, string
7979
8080 private function servePath (string $ path , Request $ request ): Response
8181 {
82- // @todo: replace this with Asset\Service::getStreamedResponseByUri() in P11
82+ $ response = Model \ Asset \Service::getStreamedResponseByUri ($ path );
8383
84- $ storage = $ this ->storage ->get ('thumbnail ' );
85- $ storagePath = urldecode ($ path );
86-
87- if ($ storage ->fileExists ($ storagePath )) {
88- $ stream = $ storage ->readStream ($ storagePath );
89-
90- return new StreamedResponse (function () use ($ stream ) {
91- fpassthru ($ stream );
92- }, Response::HTTP_OK , [
93- 'Content-Type ' => $ storage ->mimeType ($ storagePath ),
94- 'Content-Length ' => $ storage ->fileSize ($ storagePath ),
95- ]);
96- }
97-
98- $ regExpression = sprintf (
99- '/(%s)(%s)-thumb__(%s)__(%s)\/(%s)/ ' ,
100- '.* ' ,
101- 'video|image ' ,
102- '\d+ ' ,
103- '[a-zA-Z0-9_\-]+ ' ,
104- '.* '
105- );
106-
107- if (preg_match ($ regExpression , $ path , $ matches )) {
108- return $ this ->forward ('Pimcore\Bundle\CoreBundle\Controller\PublicServicesController::thumbnailAction ' , [
109- 'prefix ' => ltrim ($ matches [1 ], '/ ' ),
110- 'type ' => $ matches [2 ],
111- 'assetId ' => $ matches [3 ],
112- 'thumbnailName ' => $ matches [4 ],
113- 'filename ' => $ matches [5 ],
114- ]);
84+ if ($ response instanceof StreamedResponse) {
85+ return $ response ;
11586 }
11687
11788 // no thumbnail path found, check if the original file has been requested
0 commit comments