fix #92; fix issues with checksums

Former-commit-id: e8d1875d505a5084ab0fe6e5f85f640d11eecfc9 [formerly 8e2eeecceff1e10f538dfb004553802925d6804d] [formerly f525403b87330bad37325a285cd8d02cfdb691cf [formerly 5b5f7993a7]]
Former-commit-id: eee0030a1d35ac7808854b0bcb8e27805bc8269e [formerly bd4e6f138ebe49b73c3ac72889970301652eb999]
Former-commit-id: 9beb9cbc787c7bf4d590025f438192bfcc0cfc59
pull/726/head
Henrique Dias 2017-06-02 16:08:16 +01:00
parent 3d6e3ed2e5
commit 06b79329ae
3 changed files with 35 additions and 6 deletions

View File

@ -306,7 +306,15 @@ function getHash (event, hash) {
event.preventDefault()
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 = () => {
if (request.status >= 300) {
@ -339,15 +347,34 @@ function infoEvent (event) {
link = window.location.pathname
}
buttons.setLoading('info', false)
webdav.propfind(link)
.then((text) => {
let parser = new window.DOMParser()
let xml = parser.parseFromString(text, 'text/xml')
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
clone.getElementById('last_modified').innerHTML = xml.getElementsByTagName('getlastmodified')[0].innerHTML
let value = xml.getElementsByTagName('displayname')
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') {
clone.querySelector('.file-only').style.display = 'none'
@ -356,6 +383,7 @@ function infoEvent (event) {
document.querySelector('body').appendChild(clone)
document.querySelector('.overlay').classList.add('active')
document.querySelector('.prompt').classList.add('active')
buttons.setDone('info', true)
})
.catch(e => {
buttons.setDone('info', false)

View File

@ -220,6 +220,7 @@ listing.handleSelectionChange = function (event) {
return false
}
buttons.info.classList.remove('disabled')
fileAction.classList.add('disabled')
return false
}

View File

@ -1 +1 @@
87559c62da6283a45d7fb2271a25476c6a3fdf2a
daba2fbc36c78566185e93440bd706f4722e118e