Fix new dir and new file and utf8 names
Former-commit-id: 669a20f35e5a94af214b70502c884232a14139f8 [formerly 3eafe2a3a86e79a970816eedb6c32d67f4c8f050] [formerly a77c64652b6e8ed6a224f5fb83886d8c1b52caa1 [formerly 3785423d74]]
Former-commit-id: 407cfb10b54fca8862697c7132e138565a17b5be [formerly 88891c481ff2dbd3383355eb37ebd88f3b7885e6]
Former-commit-id: 0fabc1b8a68c87d2046767832fa0f4f62ac1f533
			
			
				pull/726/head
			
			
		
							parent
							
								
									1fa6cd8e40
								
							
						
					
					
						commit
						3a085af4bc
					
				| 
						 | 
				
			
			@ -109,6 +109,8 @@ export default {
 | 
			
		|||
  color: #333;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#login input[type="text"]:focus,
 | 
			
		||||
#login input[type="password"]:focus,
 | 
			
		||||
#login input[type="text"]:hover,
 | 
			
		||||
#login input[type="password"]:hover {
 | 
			
		||||
  border-color: #9f9f9f;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div :class="{ multiple }">
 | 
			
		||||
  <div :class="{ multiple, loading }">
 | 
			
		||||
    <header>
 | 
			
		||||
      <div>
 | 
			
		||||
        <img src="../assets/logo.svg" alt="File Manager">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ export default {
 | 
			
		|||
      event.preventDefault()
 | 
			
		||||
      if (this.new === '') return
 | 
			
		||||
 | 
			
		||||
      let uri = window.location.pathname
 | 
			
		||||
      let uri = this.$route.path
 | 
			
		||||
      if (this.$store.state.req.kind !== 'listing') {
 | 
			
		||||
        uri = url.removeLastDir(uri) + '/'
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ export default {
 | 
			
		|||
      event.preventDefault()
 | 
			
		||||
      if (this.new === '') return
 | 
			
		||||
 | 
			
		||||
      let uri = window.location.pathname
 | 
			
		||||
      let uri = this.$route.path
 | 
			
		||||
      if (this.$store.state.req.kind !== 'listing') {
 | 
			
		||||
        uri = url.removeLastDir(uri) + '/'
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ import App from './App'
 | 
			
		|||
import store from './store/store'
 | 
			
		||||
import router from './router'
 | 
			
		||||
 | 
			
		||||
Vue.config.productionTip = false
 | 
			
		||||
Vue.config.productionTip = true
 | 
			
		||||
 | 
			
		||||
/* eslint-disable no-new */
 | 
			
		||||
new Vue({
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ function login (user, password) {
 | 
			
		|||
 | 
			
		||||
function logout () {
 | 
			
		||||
  document.cookie = `auth='nothing'; max-age=0; path=${store.state.baseURL}`
 | 
			
		||||
  router.push({path: 'login'})
 | 
			
		||||
  router.push({path: '/login'})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								api.go
								
								
								
								
							
							
						
						
									
										8
									
								
								api.go
								
								
								
								
							| 
						 | 
				
			
			@ -5,6 +5,7 @@ import (
 | 
			
		|||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -212,13 +213,18 @@ func putHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int,
 | 
			
		|||
 | 
			
		||||
func postHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
 | 
			
		||||
	dst := r.Header.Get("Destination")
 | 
			
		||||
	dst, err := url.QueryUnescape(dst)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errorToHTTP(err, true), err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	src := r.URL.Path
 | 
			
		||||
 | 
			
		||||
	if dst == "/" || src == "/" {
 | 
			
		||||
		return http.StatusForbidden, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err := c.us.FileSystem.Rename(context.TODO(), src, dst)
 | 
			
		||||
	err = c.us.FileSystem.Rename(context.TODO(), src, dst)
 | 
			
		||||
	return errorToHTTP(err, true), err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue