Fixed regex.

This commit is contained in:
flash 2024-03-30 01:26:40 +00:00
parent b45fee1b7e
commit 717d7c97eb

View file

@ -22,12 +22,12 @@ class UploadsRoutes implements IRouteHandler {
HandlerAttribute::register($router, $this);
} else {
$router->options('/', $this->getUpload(...));
$router->get('/([A-Za-z0-9]+)(?:\.(t))?', $this->getUpload(...));
$router->get('/([A-Za-z0-9\-_]+)(?:\.(t))?', $this->getUpload(...));
}
}
#[HttpOptions('/uploads/([A-Za-z0-9]+)(?:\.(t|json))?')]
#[HttpGet('/uploads/([A-Za-z0-9]+)(?:\.(t|json))?')]
#[HttpOptions('/uploads/([A-Za-z0-9\-_]+)(?:\.(t|json))?')]
#[HttpGet('/uploads/([A-Za-z0-9\-_]+)(?:\.(t|json))?')]
public function getUpload($response, $request, string $fileId, string $fileExt = '') {
if($this->isApiDomain) {
if($request->hasHeader('Origin'))
@ -187,7 +187,7 @@ class UploadsRoutes implements IRouteHandler {
return $this->uploadsCtx->convertToClientJsonV1($uploadInfo);
}
#[HttpDelete('/uploads/([A-Za-z0-9]+)')]
#[HttpDelete('/uploads/([A-Za-z0-9\-_]+)')]
public function deleteUpload($response, $request, string $fileId) {
if($request->hasHeader('Origin'))
$response->setHeader('Access-Control-Allow-Credentials', 'true');