File tree Expand file tree Collapse file tree 5 files changed +583
-1
lines changed
Expand file tree Collapse file tree 5 files changed +583
-1
lines changed Original file line number Diff line number Diff line change 23302330 "data" : {
23312331 "type" : " object" ,
23322332 "required" : [
2333- " path"
2333+ " path" ,
2334+ " fileId"
23342335 ],
23352336 "properties" : {
23362337 "path" : {
23372338 "type" : " string"
2339+ },
2340+ "fileId" : {
2341+ "type" : " integer" ,
2342+ "format" : " int64"
23382343 }
23392344 }
23402345 }
Original file line number Diff line number Diff line change 1414use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
1515use OCP \AppFramework \Http \Attribute \NoCSRFRequired ;
1616use OCP \AppFramework \Http \Attribute \OpenAPI ;
17+ use OCP \AppFramework \Http \Attribute \PublicPage ;
1718use OCP \AppFramework \Http \DataResponse ;
1819use OCP \AppFramework \Http \FileDisplayResponse ;
1920use OCP \AppFramework \Http \RedirectResponse ;
@@ -183,4 +184,25 @@ private function fetchPreview(
183184 return new DataResponse ([], Http::STATUS_BAD_REQUEST );
184185 }
185186 }
187+
188+ /**
189+ * Get a preview by mime
190+ *
191+ * @param string $mime Mime type
192+ * @return RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
193+ *
194+ * 303: The mime icon url
195+ */
196+ #[NoCSRFRequired]
197+ #[PublicPage]
198+ #[FrontpageRoute(verb: 'GET ' , url: '/core/mimeicon ' )]
199+ #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT )]
200+ public function getMimeIconUrl (string $ mime = 'application/octet-stream ' ) {
201+ $ url = $ this ->mimeIconProvider ->getMimeIconUrl ($ mime );
202+ if ($ url === null ) {
203+ $ url = $ this ->mimeIconProvider ->getMimeIconUrl ('application/octet-stream ' );
204+ }
205+
206+ return new RedirectResponse ($ url );
207+ }
186208}
You can’t perform that action at this time.
0 commit comments