Fix delete and preview back links when baseURL is domain root

Former-commit-id: 3507b4b3c04620666850f91d9805c2aba6b0922a [formerly 947d4eabaf424e08e1c98aa83485ecdc103a21ef] [formerly 9f645f718de412acfb25e74bec57520100b3b18f [formerly 5fd7429d5d]]
Former-commit-id: d6ce740e97e1e2fa83f75035ac0d8442e3d11b9e [formerly d0399d9beca23a92d4241ed1001923c9903ecba0]
Former-commit-id: 1e106c3c4d098ddeac69952f94d03d20c6327ab8
pull/726/head
Henrique Dias 2017-07-01 09:30:46 +01:00
parent f5ad28723c
commit b8a5b1500c
5 changed files with 10 additions and 29 deletions

View File

@ -31,7 +31,7 @@ export default {
webdav.trash(window.location.pathname)
.then(() => {
// buttons.setDone('delete')
page.open(page.removeLastDir(window.location.pathname))
page.open(page.removeLastDir(window.location.pathname) + '/')
})
.catch(error => {
// buttons.setDone('delete', false)

View File

@ -50,8 +50,7 @@ export default {
return this.req.data.url + '?raw=true'
},
back: function (event) {
let url = page.removeLastDir(window.location.pathname)
if (url === '') url = '/'
let url = page.removeLastDir(window.location.pathname) + '/'
page.open(url)
},
allowEdit: function (event) {

View File

@ -13,7 +13,7 @@
<div>
<span v-if="search.length === 0 && commands.length === 0">{{ text() }}</span>
<ul v-else-if="search.length > 0">
<li v-for="s in search"><a :href="'.' + s">.{{ s }}</a></li>
<li v-for="s in search"><a :href="'./' + s">./{{ s }}</a></li>
</ul>
<ul v-else-if="commands.length > 0">
<li v-for="c in commands">{{ c }}</li>
@ -92,7 +92,7 @@ export default {
let uri = window.location.host + window.location.pathname
if (this.$store.state.req.kind !== 'listing') {
uri = page.removeLastDir(uri)
uri = page.removeLastDir(uri) + '/'
}
uri = `${(this.$store.state.ssl ? 'wss:' : 'ws:')}//${uri}`
@ -121,7 +121,10 @@ export default {
conn.onopen = () => conn.send(this.value)
conn.onmessage = (event) => {
this.search.push(event.data)
let url = event.data
if (url[0] === '/') url = url.substring(1)
this.search.push(url)
this.scrollable.scrollTop = this.scrollable.scrollHeight
}

View File

@ -36,7 +36,8 @@ function removeLastDir (url) {
if (arr.pop() === '') {
arr.pop()
}
return (arr.join('/'))
return arr.join('/')
}
export default {

View File

@ -48,27 +48,6 @@ function put (link, body, headers = {}) {
})
}
function propfind (link, body, headers = {}) {
return new Promise((resolve, reject) => {
let request = new window.XMLHttpRequest()
request.open('PROPFIND', convertURL(link), true)
for (let key in headers) {
request.setRequestHeader(key, headers[key])
}
request.onload = () => {
if (request.status < 300) {
resolve(request.responseText)
} else {
reject(request.statusText)
}
}
request.onerror = () => reject(request.statusText)
request.send(body)
})
}
function trash (link) {
return new Promise((resolve, reject) => {
let request = new window.XMLHttpRequest()
@ -104,7 +83,6 @@ function create (link) {
export default {
create: create,
trash: trash,
propfind: propfind,
put: put,
move: move
}