fix #92; fix issues with checksums
parent
ac7c4db4e1
commit
5b5f7993a7
|
@ -306,7 +306,15 @@ function getHash (event, hash) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
let request = new window.XMLHttpRequest()
|
let request = new window.XMLHttpRequest()
|
||||||
request.open('GET', `${window.location.pathname}?checksum=${hash}`, true)
|
let link
|
||||||
|
|
||||||
|
if (selectedItems.length) {
|
||||||
|
link = document.getElementById(selectedItems[0]).dataset.url
|
||||||
|
} else {
|
||||||
|
link = window.location.pathname
|
||||||
|
}
|
||||||
|
|
||||||
|
request.open('GET', `${link}?checksum=${hash}`, true)
|
||||||
|
|
||||||
request.onload = () => {
|
request.onload = () => {
|
||||||
if (request.status >= 300) {
|
if (request.status >= 300) {
|
||||||
|
@ -339,15 +347,34 @@ function infoEvent (event) {
|
||||||
link = window.location.pathname
|
link = window.location.pathname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttons.setLoading('info', false)
|
||||||
|
|
||||||
webdav.propfind(link)
|
webdav.propfind(link)
|
||||||
.then((text) => {
|
.then((text) => {
|
||||||
let parser = new window.DOMParser()
|
let parser = new window.DOMParser()
|
||||||
let xml = parser.parseFromString(text, 'text/xml')
|
let xml = parser.parseFromString(text, 'text/xml')
|
||||||
|
|
||||||
let clone = document.importNode(templates.info.content, true)
|
let clone = document.importNode(templates.info.content, true)
|
||||||
clone.getElementById('display_name').innerHTML = xml.getElementsByTagName('displayname')[0].innerHTML
|
|
||||||
clone.getElementById('content_length').innerHTML = xml.getElementsByTagName('getcontentlength')[0].innerHTML
|
let value = xml.getElementsByTagName('displayname')
|
||||||
clone.getElementById('last_modified').innerHTML = xml.getElementsByTagName('getlastmodified')[0].innerHTML
|
if (value.length > 0) {
|
||||||
|
clone.getElementById('display_name').innerHTML = value[0].innerHTML
|
||||||
|
} else {
|
||||||
|
clone.getElementById('display_name').innerHTML = xml.getElementsByTagName('D:displayname')[0].innerHTML
|
||||||
|
}
|
||||||
|
|
||||||
|
value = xml.getElementsByTagName('getcontentlength')
|
||||||
|
if (value.length > 0) {
|
||||||
|
clone.getElementById('content_length').innerHTML = value[0].innerHTML
|
||||||
|
} else {
|
||||||
|
clone.getElementById('content_length').innerHTML = xml.getElementsByTagName('D:getcontentlength')[0].innerHTML
|
||||||
|
}
|
||||||
|
|
||||||
|
value = xml.getElementsByTagName('getlastmodified')
|
||||||
|
if (value.length > 0) {
|
||||||
|
clone.getElementById('last_modified').innerHTML = value[0].innerHTML
|
||||||
|
} else {
|
||||||
|
clone.getElementById('last_modified').innerHTML = xml.getElementsByTagName('D:getlastmodified')[0].innerHTML
|
||||||
|
}
|
||||||
|
|
||||||
if (dir === true || dir === 'true') {
|
if (dir === true || dir === 'true') {
|
||||||
clone.querySelector('.file-only').style.display = 'none'
|
clone.querySelector('.file-only').style.display = 'none'
|
||||||
|
@ -356,6 +383,7 @@ function infoEvent (event) {
|
||||||
document.querySelector('body').appendChild(clone)
|
document.querySelector('body').appendChild(clone)
|
||||||
document.querySelector('.overlay').classList.add('active')
|
document.querySelector('.overlay').classList.add('active')
|
||||||
document.querySelector('.prompt').classList.add('active')
|
document.querySelector('.prompt').classList.add('active')
|
||||||
|
buttons.setDone('info', true)
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
buttons.setDone('info', false)
|
buttons.setDone('info', false)
|
||||||
|
|
|
@ -220,6 +220,7 @@ listing.handleSelectionChange = function (event) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttons.info.classList.remove('disabled')
|
||||||
fileAction.classList.add('disabled')
|
fileAction.classList.add('disabled')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue