fix names with spaces

This commit is contained in:
Pierre Dubouilh
2019-03-31 17:05:21 +02:00
parent 3e01b7a0ab
commit 8769257692
+6 -6
View File
@@ -122,7 +122,7 @@ let totalUploads = 0
let totalUploadsSize = 0 let totalUploadsSize = 0
let totalUploadedSize = [] let totalUploadedSize = []
const dupe = test => allA.find(a => a.innerText.replace('/', '') === test) const dupe = test => allA.find(a => a.innerHTML.replace('/', '') === test)
const isDupe = t => dupe(t) ? alert(t + ' already already exists') || true : false const isDupe = t => dupe(t) ? alert(t + ' already already exists') || true : false
function shouldRefresh () { function shouldRefresh () {
@@ -231,7 +231,7 @@ document.ondragenter = e => {
} }
} }
document.ondragstart = e => { draggingSrc = e.target.innerText } document.ondragstart = e => { draggingSrc = e.target.innerHTML }
document.ondragend = e => resetBackgroundLinks() document.ondragend = e => resetBackgroundLinks()
@@ -248,7 +248,7 @@ document.ondrop = e => {
// move to a folder // move to a folder
if (draggingSrc && t) { if (draggingSrc && t) {
const dest = t.innerText + draggingSrc const dest = t.innerHTML + draggingSrc
ensureMove() || mvCall(prependPath(draggingSrc), prependPath(dest), refresh) ensureMove() || mvCall(prependPath(draggingSrc), prependPath(dest), refresh)
// ... or upload // ... or upload
} else if (e.dataTransfer.items.length) { } else if (e.dataTransfer.items.length) {
@@ -302,7 +302,7 @@ function padOff () {
async function displayPad (a) { async function displayPad (a) {
if (a) { if (a) {
try { try {
fileEdited = a.innerText fileEdited = a.innerHTML
const f = await fetch(a.href, { const f = await fetch(a.href, {
credentials: 'include', credentials: 'include',
headers: new Headers({ headers: new Headers({
@@ -367,7 +367,7 @@ window.rename = (e, commit) => {
return return
} }
const orig = e.key ? getASelected().innerText : getBtnA(e).innerText const orig = e.key ? getASelected().innerHTML : getBtnA(e).innerHTML
const chg = prompt('rename to', orig) const chg = prompt('rename to', orig)
if (chg && !isDupe(chg)) { if (chg && !isDupe(chg)) {
mvCall(prependPath(orig), prependPath(chg), refresh) mvCall(prependPath(orig), prependPath(chg), refresh)
@@ -488,7 +488,7 @@ function onPaste () {
const root = cuts.pop() const root = cuts.pop()
const filename = root.split('/').pop() const filename = root.split('/').pop()
const pwd = decodeURIComponent(location.pathname) const pwd = decodeURIComponent(location.pathname)
const dest = isFolder(a) ? pwd + a.innerText : pwd const dest = isFolder(a) ? pwd + a.innerHTML : pwd
mvCall(root, dest + filename, onPaste) mvCall(root, dest + filename, onPaste)
} }