diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-03 11:10:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-03 11:10:40 +0100 |
commit | 01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea (patch) | |
tree | 9e01809f09adbcd512a8dedf73093a123f88e02c /server/helpers | |
parent | 47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (diff) | |
download | PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.gz PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.zst PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.zip |
Add avatar max size limit
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/misc.ts | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index 630bace30..700e06007 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts | |||
@@ -24,7 +24,7 @@ function isActorPublicKeyValid (publicKey: string) { | |||
24 | typeof publicKey === 'string' && | 24 | typeof publicKey === 'string' && |
25 | publicKey.startsWith('-----BEGIN PUBLIC KEY-----') && | 25 | publicKey.startsWith('-----BEGIN PUBLIC KEY-----') && |
26 | publicKey.indexOf('-----END PUBLIC KEY-----') !== -1 && | 26 | publicKey.indexOf('-----END PUBLIC KEY-----') !== -1 && |
27 | validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTOR.PUBLIC_KEY) | 27 | validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY) |
28 | } | 28 | } |
29 | 29 | ||
30 | const actorNameRegExp = new RegExp('[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_]+') | 30 | const actorNameRegExp = new RegExp('[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_]+') |
@@ -42,7 +42,7 @@ function isActorPrivateKeyValid (privateKey: string) { | |||
42 | privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') && | 42 | privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') && |
43 | // Sometimes there is a \n at the end, so just assert the string contains the end mark | 43 | // Sometimes there is a \n at the end, so just assert the string contains the end mark |
44 | privateKey.indexOf('-----END RSA PRIVATE KEY-----') !== -1 && | 44 | privateKey.indexOf('-----END RSA PRIVATE KEY-----') !== -1 && |
45 | validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTOR.PRIVATE_KEY) | 45 | validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY) |
46 | } | 46 | } |
47 | 47 | ||
48 | function isRemoteActorValid (remoteActor: any) { | 48 | function isRemoteActorValid (remoteActor: any) { |
diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts index aa6ffc9bd..75d308e9d 100644 --- a/server/helpers/custom-validators/activitypub/misc.ts +++ b/server/helpers/custom-validators/activitypub/misc.ts | |||
@@ -17,7 +17,7 @@ function isActivityPubUrlValid (url: string) { | |||
17 | isURLOptions.require_tld = false | 17 | isURLOptions.require_tld = false |
18 | } | 18 | } |
19 | 19 | ||
20 | return exists(url) && validator.isURL('' + url, isURLOptions) && validator.isLength('' + url, CONSTRAINTS_FIELDS.ACTOR.URL) | 20 | return exists(url) && validator.isURL('' + url, isURLOptions) && validator.isLength('' + url, CONSTRAINTS_FIELDS.ACTORS.URL) |
21 | } | 21 | } |
22 | 22 | ||
23 | function isBaseActivityValid (activity: any, type: string) { | 23 | function isBaseActivityValid (activity: any, type: string) { |