aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-15 14:41:55 +0100
committerChocobozzz <me@florianbigard.com>2022-11-15 14:41:55 +0100
commit4638cd713dcdd007cd7f49b9a95fa62ac7823e7c (patch)
tree3e341c6ebbd1ce9e2bbacd72e7e3793e0bd467c2 /shared/core-utils
parent6bcb559fc9a491fc3ce83e7c077ee9dc742b1d63 (diff)
downloadPeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.tar.gz
PeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.tar.zst
PeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.zip
Don't inject untrusted input
Even if it's already checked in middlewares It's better to have safe modals too
Diffstat (limited to 'shared/core-utils')
-rw-r--r--shared/core-utils/common/index.ts1
-rw-r--r--shared/core-utils/common/number.ts7
2 files changed, 8 insertions, 0 deletions
diff --git a/shared/core-utils/common/index.ts b/shared/core-utils/common/index.ts
index 720977ead..8d63ee1b2 100644
--- a/shared/core-utils/common/index.ts
+++ b/shared/core-utils/common/index.ts
@@ -2,6 +2,7 @@ export * from './array'
2export * from './random' 2export * from './random'
3export * from './date' 3export * from './date'
4export * from './env' 4export * from './env'
5export * from './number'
5export * from './object' 6export * from './object'
6export * from './path' 7export * from './path'
7export * from './regexp' 8export * from './regexp'
diff --git a/shared/core-utils/common/number.ts b/shared/core-utils/common/number.ts
new file mode 100644
index 000000000..9a96dcf5c
--- /dev/null
+++ b/shared/core-utils/common/number.ts
@@ -0,0 +1,7 @@
1function forceNumber (value: any) {
2 return parseInt(value + '')
3}
4
5export {
6 forceNumber
7}