From 7dbe383269d9de47911df5f368d6a90eac7f3d26 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 3 Jun 2019 16:05:53 +0200 Subject: [PATCH] more Plecos validations --- client/src/models/AssetModel.ts | 4 ++-- client/src/routes/Publish/index.tsx | 5 ++++- server/src/routes/UrlCheckRouter.ts | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/models/AssetModel.ts b/client/src/models/AssetModel.ts index e250909..7538119 100644 --- a/client/src/models/AssetModel.ts +++ b/client/src/models/AssetModel.ts @@ -12,11 +12,11 @@ const AssetModel = { type: '', license: null, copyrightHolder: null, - workExample: null, + workExample: '', files: [], categories: [], links: [], - inLanguage: null, + inLanguage: '', tags: [], price: '' }, diff --git a/client/src/routes/Publish/index.tsx b/client/src/routes/Publish/index.tsx index 0f9b655..54c9ff6 100644 --- a/client/src/routes/Publish/index.tsx +++ b/client/src/routes/Publish/index.tsx @@ -273,7 +273,10 @@ export default class Publish extends Component<{}, PublishState> { base: Object.assign(AssetModel.base, { name: this.state.name, description: this.state.description, - dateCreated: new Date(this.state.dateCreated).toISOString(), + dateCreated: + new Date(this.state.dateCreated) + .toISOString() + .split('.')[0] + 'Z', // remove milliseconds author: this.state.author, license: this.state.license, copyrightHolder: this.state.copyrightHolder, diff --git a/server/src/routes/UrlCheckRouter.ts b/server/src/routes/UrlCheckRouter.ts index 09eccae..dbe6eff 100644 --- a/server/src/routes/UrlCheckRouter.ts +++ b/server/src/routes/UrlCheckRouter.ts @@ -31,8 +31,9 @@ export class UrlCheckRouter { result.found = true if (response.headers['content-length']) { - result.contentLength = + result.contentLength = parseInt( response.headers['content-length'] + ) // convert to number } if (response.headers['content-type']) {