File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed 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,24 @@ private function fetchPreview(
183184 return new DataResponse ([], Http::STATUS_BAD_REQUEST );
184185 }
185186 }
187+
188+ /**
189+ * Get a preview by mime
190+ *
191+ * @return RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
192+ *
193+ * 303: The mime icon url
194+ */
195+ #[NoCSRFRequired]
196+ #[PublicPage]
197+ #[FrontpageRoute(verb: 'GET ' , url: '/core/mimeicon ' )]
198+ #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT )]
199+ public function getMimeIconUrl (string $ mime = 'application/octet-stream ' ) {
200+ $ url = $ this ->mimeIconProvider ->getMimeIconUrl ($ mime );
201+ if ($ url === null ) {
202+ $ url = $ this ->mimeIconProvider ->getMimeIconUrl ('application/octet-stream ' );
203+ }
204+
205+ return new RedirectResponse ($ url );
206+ }
186207}
You can’t perform that action at this time.
0 commit comments