Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean-Pearce committed Apr 15, 2020
1 parent 7a480c8 commit a21a046
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion portal/src/api/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function download(params) {
return request({
url: '/storage/download',
method: 'get',
params
params: {
filename: params
}
})
}

Expand Down
1 change: 0 additions & 1 deletion portal/src/views/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export default {
},
handleUpload(req) {
upload(req)
this.fetchData()
},
handleDownload(filename) {
download(filename)
Expand Down
4 changes: 3 additions & 1 deletion service/httpserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func upload(c *gin.Context) {

func download(c *gin.Context) {
username := getUsernameByToken(c.GetHeader("X-Token"))
filename := path.Join(username, c.Request.FormValue("filename"))
filename := c.Query("filename")

var file File
db.First(&file, "name = ?", filename)
Expand All @@ -230,6 +230,8 @@ func download(c *gin.Context) {
return
}

filename = path.Join(username, filename)

resp, err := clientMap[file.Sites[0].Name].download(filename)
if err != nil || resp.StatusCode != http.StatusOK {
c.JSON(http.StatusInternalServerError, gin.H{
Expand Down

0 comments on commit a21a046

Please sign in to comment.