From 0d7b920cbe65383e0684d74a83a042ae47efedb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Holba?= Date: Sun, 6 Sep 2020 20:29:16 +0200 Subject: [PATCH] v0.1 add check mimetype if mimetype of file is undefined --- app/Rules/MimetypeBlacklistValidation.php | 6 +++--- resources/js/helpers.js | 11 +++++++---- resources/js/i18n/lang/cn.json | 2 +- resources/js/i18n/lang/en.json | 2 +- resources/js/i18n/lang/sk.json | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/Rules/MimetypeBlacklistValidation.php b/app/Rules/MimetypeBlacklistValidation.php index ab71a82d..390da73f 100644 --- a/app/Rules/MimetypeBlacklistValidation.php +++ b/app/Rules/MimetypeBlacklistValidation.php @@ -25,9 +25,9 @@ class MimetypeBlacklistValidation implements Rule public function passes($attribute, $value) { $mimetype_blacklist = explode(',' ,get_setting('mimetypes_blacklist')); - $fileMimetype = explode('/' ,$value->getMimeType()); - - return !array_intersect($fileMimetype , $mimetype_blacklist); + $file_mimetype = explode('/' ,$value->getMimeType()); + + return !array_intersect($file_mimetype , $mimetype_blacklist); } /** diff --git a/resources/js/helpers.js b/resources/js/helpers.js index f3dd01a7..8f53f5a0 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -10,7 +10,7 @@ const Helpers = { Vue.prototype.$updateText = debounce(function (route, name, value) { - if (value === '') return + // if (value === '') return axios.post(this.$store.getters.api + route, {name, value, _method: 'patch'}) .catch(error => { @@ -283,14 +283,17 @@ const Helpers = { Vue.prototype.$checkFileMimetype = function(files) { let validated = true let mimetypesBlacklist = store.getters.config.mimetypesBlacklist - console.log(files[0]) for (let i = 0 ; i Use a comma between each mime type. Don't use a dot before mimetypes." , + "mimetypes_blacklist_help" :"If you want ban some type of files to upload just add them to blacklist like this: x-php,mp3,jpeg
Use a comma between each mime type. Don't use a dot before mimetypes." , "section_cache": "Application Cache", "cache_disclaimer": "Did you change anything in your .env file or change your stripe credentials? Then clear your cache.", "cache_clear": "Clear Cache", diff --git a/resources/js/i18n/lang/en.json b/resources/js/i18n/lang/en.json index 77f842c5..5c3c064d 100644 --- a/resources/js/i18n/lang/en.json +++ b/resources/js/i18n/lang/en.json @@ -212,7 +212,7 @@ "others": { "mimetypes_blacklist": "Mimetypes Blacklist", "mimetypes_blacklist_plac":"Add mimetypes to Blacklist" , - "mimetypes_blacklist_help" :"If you want ban some type of files to upload just add them to blacklist like this: php,mp3,jpeg
Use a comma between each mime type. Don't use a dot before mimetypes." , + "mimetypes_blacklist_help" :"If you want ban some type of files to upload just add them to blacklist like this: x-php,mp3,jpeg
Use a comma between each mime type. Don't use a dot before mimetypes." , "section_cache": "Application Cache", "cache_disclaimer": "Did you change anything in your .env file or change your Stripe credentials? Then clear your cache.", "cache_clear": "Clear Cache", diff --git a/resources/js/i18n/lang/sk.json b/resources/js/i18n/lang/sk.json index ebf4a943..c3fe7947 100644 --- a/resources/js/i18n/lang/sk.json +++ b/resources/js/i18n/lang/sk.json @@ -212,7 +212,7 @@ "others": { "mimetypes_blacklist": "Čierna listina mimetypov", "mimetypes_blacklist_plac":"Pridajte mimetypy do Čiernej listiny", - "mimetypes_blacklist_help" :"Ak chcete zakázať nahrávanie niektorých typov súborov, jednoducho ich pridajte na čiernu listinu, príklad: php, mp3, jpeg
Medzi mimetypmi použite čiarku. Nevkladajte bodku pred mimetyp." , + "mimetypes_blacklist_help" :"Ak chcete zakázať nahrávanie niektorých typov súborov, jednoducho ich pridajte na čiernu listinu, príklad: x-php, mp3, jpeg
Medzi mimetypmi použite čiarku. Nevkladajte bodku pred mimetyp." , "section_cache": "Aplikačná pamäť", "cache_disclaimer": "Zmenili ste niečo v .env súbore alebo ste zmenili Stripe poverenia? Vymažte aplikačnú pamäť.", "cache_clear": "Vymazať aplikačnú pamäť",