Fix file name & extension in upload options

pull/1/head
ClemDee 6 years ago
parent 73dcce564e
commit 1361334eaf

@ -235,9 +235,9 @@ define([
store: true store: true
}; };
var fileUploadModal = function (file, cb) { var fileUploadModal = function (file, cb) {
var extIdx = file.name.lastIndexOf('.'); var parsedName = /^(\.?.+?)(\.[^.]+)?$/.exec(file.name) || [];
var name = extIdx !== -1 ? file.name.slice(0,extIdx) : file.name; var name = parsedName[1] || file.name;
var ext = extIdx !== -1 ? file.name.slice(extIdx) : ""; var ext = parsedName[2] || "";
var createHelper = function (href, text) { var createHelper = function (href, text) {
var q = h('a.fa.fa-question-circle', { var q = h('a.fa.fa-question-circle', {
@ -264,7 +264,7 @@ define([
h('h4', Messages.upload_modal_title), h('h4', Messages.upload_modal_title),
UIElements.setHTML(h('label', {for: 'cp-upload-name'}), UIElements.setHTML(h('label', {for: 'cp-upload-name'}),
Messages._getKey('upload_modal_filename', [ext])), Messages._getKey('upload_modal_filename', [ext])),
h('input#cp-upload-name', {type: 'text', placeholder: name}), h('input#cp-upload-name', {type: 'text', placeholder: name, value: name}),
h('label', {for: 'cp-upload-password'}, Messages.creation_passwordValue), h('label', {for: 'cp-upload-password'}, Messages.creation_passwordValue),
UI.passwordInput({id: 'cp-upload-password'}), UI.passwordInput({id: 'cp-upload-password'}),
h('span', { h('span', {

Loading…
Cancel
Save