Skip to content

Commit

Permalink
datasvc: Check for filename parameter else use url path as filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohitty committed Aug 21, 2019
1 parent 2cbaf3b commit 41925d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/revad/svcs/httpsvcs/datasvc/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ import (
func (s *svc) doGet(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
log := appctx.GetLogger(ctx)
var fn string
files, ok := r.URL.Query()["filename"]
if !ok || len(files[0]) < 1 {
w.WriteHeader(http.StatusBadRequest)
return
fn = r.URL.Path
} else {
fn = files[0]
}
fn := files[0]

fsfn := strings.TrimPrefix(fn, s.conf.ProviderPath)
ref := &storageproviderv0alphapb.Reference{Spec: &storageproviderv0alphapb.Reference_Path{Path: fsfn}}
Expand Down

0 comments on commit 41925d9

Please sign in to comment.