mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-28 15:24:43 +00:00
v0.1 add check mimetype if mimetype of file is undefined
This commit is contained in:
@@ -25,9 +25,9 @@ class MimetypeBlacklistValidation implements Rule
|
|||||||
public function passes($attribute, $value)
|
public function passes($attribute, $value)
|
||||||
{
|
{
|
||||||
$mimetype_blacklist = explode(',' ,get_setting('mimetypes_blacklist'));
|
$mimetype_blacklist = explode(',' ,get_setting('mimetypes_blacklist'));
|
||||||
$fileMimetype = explode('/' ,$value->getMimeType());
|
$file_mimetype = explode('/' ,$value->getMimeType());
|
||||||
|
|
||||||
return !array_intersect($fileMimetype , $mimetype_blacklist);
|
return !array_intersect($file_mimetype , $mimetype_blacklist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Vendored
+5
-2
@@ -10,7 +10,7 @@ const Helpers = {
|
|||||||
|
|
||||||
Vue.prototype.$updateText = debounce(function (route, name, value) {
|
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'})
|
axios.post(this.$store.getters.api + route, {name, value, _method: 'patch'})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -283,11 +283,14 @@ const Helpers = {
|
|||||||
Vue.prototype.$checkFileMimetype = function(files) {
|
Vue.prototype.$checkFileMimetype = function(files) {
|
||||||
let validated = true
|
let validated = true
|
||||||
let mimetypesBlacklist = store.getters.config.mimetypesBlacklist
|
let mimetypesBlacklist = store.getters.config.mimetypesBlacklist
|
||||||
console.log(files[0])
|
|
||||||
|
|
||||||
for (let i = 0 ; i<files.length; i++ ) {
|
for (let i = 0 ; i<files.length; i++ ) {
|
||||||
let fileType = files[i].type.split("/")
|
let fileType = files[i].type.split("/")
|
||||||
|
|
||||||
|
if(!fileType[0]) {
|
||||||
|
fileType[1] = _.last(files[i].name.split('.'))
|
||||||
|
}
|
||||||
|
|
||||||
if(mimetypesBlacklist.includes(fileType[1])) {
|
if(mimetypesBlacklist.includes(fileType[1])) {
|
||||||
validated = false
|
validated = false
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,7 @@
|
|||||||
"others": {
|
"others": {
|
||||||
"mimetypes_blacklist": "Mimetypes Blacklist",
|
"mimetypes_blacklist": "Mimetypes Blacklist",
|
||||||
"mimetypes_blacklist_plac":"Add mimetypes to 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 <br/> 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 <br/> Use a comma between each mime type. Don't use a dot before mimetypes." ,
|
||||||
"section_cache": "Application Cache",
|
"section_cache": "Application Cache",
|
||||||
"cache_disclaimer": "Did you change anything in your .env file or change your stripe credentials? Then clear your cache.",
|
"cache_disclaimer": "Did you change anything in your .env file or change your stripe credentials? Then clear your cache.",
|
||||||
"cache_clear": "Clear Cache",
|
"cache_clear": "Clear Cache",
|
||||||
|
|||||||
@@ -212,7 +212,7 @@
|
|||||||
"others": {
|
"others": {
|
||||||
"mimetypes_blacklist": "Mimetypes Blacklist",
|
"mimetypes_blacklist": "Mimetypes Blacklist",
|
||||||
"mimetypes_blacklist_plac":"Add mimetypes to 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 <br/> 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 <br/> Use a comma between each mime type. Don't use a dot before mimetypes." ,
|
||||||
"section_cache": "Application Cache",
|
"section_cache": "Application Cache",
|
||||||
"cache_disclaimer": "Did you change anything in your .env file or change your Stripe credentials? Then clear your cache.",
|
"cache_disclaimer": "Did you change anything in your .env file or change your Stripe credentials? Then clear your cache.",
|
||||||
"cache_clear": "Clear Cache",
|
"cache_clear": "Clear Cache",
|
||||||
|
|||||||
@@ -212,7 +212,7 @@
|
|||||||
"others": {
|
"others": {
|
||||||
"mimetypes_blacklist": "Čierna listina mimetypov",
|
"mimetypes_blacklist": "Čierna listina mimetypov",
|
||||||
"mimetypes_blacklist_plac":"Pridajte mimetypy do Čiernej listiny",
|
"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 <br/> 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 <br/> Medzi mimetypmi použite čiarku. Nevkladajte bodku pred mimetyp." ,
|
||||||
"section_cache": "Aplikačná pamäť",
|
"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_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äť",
|
"cache_clear": "Vymazať aplikačnú pamäť",
|
||||||
|
|||||||
Reference in New Issue
Block a user