Fix delete and preview back links when baseURL is domain root
							parent
							
								
									f015cc39e8
								
							
						
					
					
						commit
						5fd7429d5d
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,8 @@ function removeLastDir (url) {
 | 
			
		|||
  if (arr.pop() === '') {
 | 
			
		||||
    arr.pop()
 | 
			
		||||
  }
 | 
			
		||||
  return (arr.join('/'))
 | 
			
		||||
 | 
			
		||||
  return arr.join('/')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue