Merge pull request #991 from ramiresviana/small-fixes

This commit is contained in:
Oleg Lobanov 2020-06-18 09:59:27 +02:00 committed by GitHub
commit d6d47bbd6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -132,7 +132,7 @@ export default {
return return
} }
if (event.shiftKey) { if (event.shiftKey && this.selected.length > 0) {
let fi = 0 let fi = 0
let la = 0 let la = 0
@ -145,8 +145,10 @@ export default {
} }
for (; fi <= la; fi++) { for (; fi <= la; fi++) {
if (this.$store.state.selected.indexOf(fi) == -1) {
this.addSelected(fi) this.addSelected(fi)
} }
}
return return
} }

View File

@ -12,10 +12,6 @@ export function parseToken (token) {
const data = JSON.parse(Base64.decode(parts[1])) const data = JSON.parse(Base64.decode(parts[1]))
if (Math.round(new Date().getTime() / 1000) > data.exp) {
throw new Error('token expired')
}
localStorage.setItem('jwt', token) localStorage.setItem('jwt', token)
store.commit('setJWT', token) store.commit('setJWT', token)
store.commit('setUser', data.user) store.commit('setUser', data.user)

View File

@ -93,6 +93,11 @@ var resourcePostPutHandler = withUser(func(w http.ResponseWriter, r *http.Reques
} }
} }
action := "upload"
if r.Method == http.MethodPut {
action = "save"
}
err := d.RunHook(func() error { err := d.RunHook(func() error {
dir, _ := filepath.Split(r.URL.Path) dir, _ := filepath.Split(r.URL.Path)
err := d.user.Fs.MkdirAll(dir, 0775) err := d.user.Fs.MkdirAll(dir, 0775)
@ -120,7 +125,7 @@ var resourcePostPutHandler = withUser(func(w http.ResponseWriter, r *http.Reques
etag := fmt.Sprintf(`"%x%x"`, info.ModTime().UnixNano(), info.Size()) etag := fmt.Sprintf(`"%x%x"`, info.ModTime().UnixNano(), info.Size())
w.Header().Set("ETag", etag) w.Header().Set("ETag", etag)
return nil return nil
}, "upload", r.URL.Path, "", d.user) }, action, r.URL.Path, "", d.user)
return errToStatus(err), err return errToStatus(err), err
}) })