mirror of
https://github.com/filegator/filegator.git
synced 2025-08-08 16:56:33 +02:00
refactor so that you can disable all editable extensions, including .txt
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Upcoming...
|
## Upcoming...
|
||||||
|
|
||||||
|
* Fixes #153 (Thanks @Gui13)
|
||||||
|
|
||||||
## 7.4.6 - 2020-11-02
|
## 7.4.6 - 2020-11-02
|
||||||
|
|
||||||
* New feature - upload folder with drag&drop, fixes #25 (Thanks @ahaenggli)
|
* New feature - upload folder with drag&drop, fixes #25 (Thanks @ahaenggli)
|
||||||
|
@@ -3,6 +3,7 @@ import moment from 'moment'
|
|||||||
import store from '../store.js'
|
import store from '../store.js'
|
||||||
import api from '../api/api'
|
import api from '../api/api'
|
||||||
import { Base64 } from 'js-base64'
|
import { Base64 } from 'js-base64'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
import english from '../translations/english'
|
import english from '../translations/english'
|
||||||
import spanish from '../translations/spanish'
|
import spanish from '../translations/spanish'
|
||||||
@@ -142,13 +143,13 @@ const funcs = {
|
|||||||
return this.isText(name) || this.isImage(name)
|
return this.isText(name) || this.isImage(name)
|
||||||
},
|
},
|
||||||
isText(name) {
|
isText(name) {
|
||||||
return this.hasExtension(name, (store.state.config.editable && store.state.config.editable.length > 0) ? store.state.config.editable : ['.txt'])
|
return this.hasExtension(name, store.state.config.editable)
|
||||||
},
|
},
|
||||||
isImage(name) {
|
isImage(name) {
|
||||||
return this.hasExtension(name, ['.jpg', '.jpeg', '.gif', '.png', '.bmp', '.svg', '.tiff', '.tif'])
|
return this.hasExtension(name, ['.jpg', '.jpeg', '.gif', '.png', '.bmp', '.svg', '.tiff', '.tif'])
|
||||||
},
|
},
|
||||||
hasExtension(name, exts) {
|
hasExtension(name, exts) {
|
||||||
return (new RegExp('(' + exts.join('|').replace(/\./g, '\\.') + ')$', 'i')).test(name)
|
return !_.isEmpty(exts) && (new RegExp('(' + exts.join('|').replace(/\./g, '\\.') + ')$', 'i')).test(name)
|
||||||
},
|
},
|
||||||
capitalize(string) {
|
capitalize(string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||||
|
Reference in New Issue
Block a user