Fix delete and preview back links when baseURL is domain root

pull/144/head
Henrique Dias 2017-07-01 09:30:46 +01:00
parent f015cc39e8
commit 5fd7429d5d
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
5 changed files with 10 additions and 29 deletions

View File

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

View File

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

View File

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

View File

@ -36,7 +36,8 @@ function removeLastDir (url) {
if (arr.pop() === '') { if (arr.pop() === '') {
arr.pop() arr.pop()
} }
return (arr.join('/'))
return arr.join('/')
} }
export default { 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) { function trash (link) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let request = new window.XMLHttpRequest() let request = new window.XMLHttpRequest()
@ -104,7 +83,6 @@ function create (link) {
export default { export default {
create: create, create: create,
trash: trash, trash: trash,
propfind: propfind,
put: put, put: put,
move: move move: move
} }