Skip to content

Commit

Permalink
fix(save): reset the meta and structure paths after assign
Browse files Browse the repository at this point in the history
now that we have the handy new SetPath function, we can reset the meta and structure paths after assign. assign clobbers the changed paths with the previous paths. this means that the datasetDiffer will assume no changes have been made in the meta or structure. we want the datasetDiffer to have to check each field, so we reset the path
  • Loading branch information
ramfox committed Feb 15, 2018
1 parent b8a4d06 commit c815bd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// middleware handles request logging
func (s *Server) middleware(handler http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
s.log.Infof("%s %s %s", r.Method, r.URL.Path, time.Now())
s.log.Infof("%s %s %s\n", r.Method, r.URL.Path, time.Now())

// If this server is operating behind a proxy, but we still want to force
// users to use https, cfg.ProxyForceHttps == true will listen for the common
Expand Down
11 changes: 8 additions & 3 deletions core/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,14 @@ func (r *DatasetRequests) Save(p *SaveParams, res *repo.DatasetRef) (err error)
ds.Commit.Message = ""
}

// TODO - error here, since Meta and Structure don't have paths
// When we use the Assign() function, we clobber their paths
// with the old paths
// Assign will assign any previous paths to the current paths
// the datasetDiffer (called in dsfs.CreateDataset), will compare the paths
// see that they are the same, and claim there are no differences
// since we will potentially have changes in the Meta and Structure
// we want the differ to have to compare each field
// so we reset the paths
ds.Meta.SetPath("")
ds.Structure.SetPath("")

dataf = memfs.NewMemfileBytes("data."+st.Format.String(), data)
dspath, err := r.repo.CreateDataset(ds, dataf, true)
Expand Down

0 comments on commit c815bd6

Please sign in to comment.