Skip to content

Commit

Permalink
fix(structuredData): data should return DataPath not dataset Path
Browse files Browse the repository at this point in the history
  • Loading branch information
ramfox committed Mar 12, 2018
1 parent d50e510 commit 7bae799
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions api/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/qri-io/dataset"
"net/http"
"os"
"path/filepath"
"strings"

"github.com/qri-io/dataset"

util "github.com/datatogether/api/apiutil"
"github.com/qri-io/cafs/memfs"
"github.com/qri-io/dataset/dsutil"
Expand Down Expand Up @@ -605,6 +606,10 @@ func (h DatasetHandlers) dataHandler(w http.ResponseWriter, r *http.Request) {
return
}

if err := repo.CanonicalizeDatasetRef(h.repo, &d); err != nil {
util.WriteErrResponse(w, http.StatusInternalServerError, err)
}

limit, err := util.ReqParamInt("limit", r)
if err != nil {
limit = defaultDataLimit
Expand Down Expand Up @@ -632,7 +637,7 @@ func (h DatasetHandlers) dataHandler(w http.ResponseWriter, r *http.Request) {

page := util.PageFromRequest(r)
dataResponse := DataResponse{
Path: p.Path,
Path: data.Path,
Data: json.RawMessage(data.Data),
}
if err := util.WritePageResponse(w, dataResponse, r, page); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func (r *DatasetRequests) StructuredData(p *StructuredDataParams, data *Structur
}

*data = StructuredData{
Path: p.Path,
Path: ds.DataPath,
Data: buf.Bytes(),
}
return nil
Expand Down

0 comments on commit 7bae799

Please sign in to comment.