Merge branch 'main' into sdk

This commit is contained in:
rijkvanzanten
2020-10-27 10:56:06 +01:00
24 changed files with 433 additions and 255 deletions

View File

@@ -12,6 +12,7 @@ import url from 'url';
import path from 'path';
import useCollection from '../middleware/use-collection';
import { respond } from '../middleware/respond';
import { toArray } from '../utils/to-array';
const router = express.Router();
@@ -32,7 +33,7 @@ const multipartHandler = asyncHandler(async (req, res, next) => {
* the row in directus_files async during the upload of the actual file.
*/
let disk: string = (env.STORAGE_LOCATIONS as string).split(',')[0].trim();
let disk: string = toArray(env.STORAGE_LOCATIONS)[0];
let payload: Partial<File> = {};
let fileCount = 0;
@@ -155,7 +156,7 @@ router.post(
const payload = {
filename_download: filename,
storage: (env.STORAGE_LOCATIONS as string).split(',')[0].trim(),
storage: toArray(env.STORAGE_LOCATIONS)[0],
type: fileResponse.headers['content-type'],
title: formatTitle(filename),
...(req.body.data || {}),

View File

@@ -20,12 +20,12 @@ router.get('/ping', (req, res) => res.send('pong'));
router.get(
'/info',
(req, res, next) => {
asyncHandler(async (req, res, next) => {
const service = new ServerService({ accountability: req.accountability });
const data = service.serverInfo();
const data = await service.serverInfo();
res.locals.payload = { data };
return next();
},
}),
respond
);