summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/api
diff options
context:
space:
mode:
authorHiramiya <Hiramiya@users.noreply.github.com>2018-08-27 20:03:28 +0100
committerGitHub <noreply@github.com>2018-08-27 20:03:28 +0100
commitd1a956113554d3be174207d90770eb5d4875cd46 (patch)
treee3cbc414a84e36d313c55d462d5207c27176ba7f /src/client/app/desktop/api
parentUpdate update-avatar.ts (diff)
downloadsharkey-d1a956113554d3be174207d90770eb5d4875cd46.tar.gz
sharkey-d1a956113554d3be174207d90770eb5d4875cd46.tar.bz2
sharkey-d1a956113554d3be174207d90770eb5d4875cd46.zip
Restrict avatar filetypes
Diffstat (limited to 'src/client/app/desktop/api')
-rw-r--r--src/client/app/desktop/api/update-avatar.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts
index 18b912d148..f07dc623f2 100644
--- a/src/client/app/desktop/api/update-avatar.ts
+++ b/src/client/app/desktop/api/update-avatar.ts
@@ -6,6 +6,19 @@ import ProgressDialog from '../views/components/progress-dialog.vue';
export default (os: OS) => {
const cropImage = file => new Promise((resolve, reject) => {
+
+ var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$')
+ if(!regex.test(file.name) ) {
+ os.apis.dialog({
+ title: '%fa:info-circle% %i18n:desktop.invalid-filetype%',
+ text: null,
+ actions: [{
+ text: '%i18n:common.got-it%'
+ }]
+ });
+ reject
+ }
+
const w = os.new(CropWindow, {
image: file,
title: '%i18n:desktop.avatar-crop-title%',