Skip to content

Commit c815bd6

Browse files
committed
fix(save): reset the meta and structure paths after assign
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
1 parent b8a4d06 commit c815bd6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

api/middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// middleware handles request logging
1010
func (s *Server) middleware(handler http.HandlerFunc) http.HandlerFunc {
1111
return func(w http.ResponseWriter, r *http.Request) {
12-
s.log.Infof("%s %s %s", r.Method, r.URL.Path, time.Now())
12+
s.log.Infof("%s %s %s\n", r.Method, r.URL.Path, time.Now())
1313

1414
// If this server is operating behind a proxy, but we still want to force
1515
// users to use https, cfg.ProxyForceHttps == true will listen for the common

core/datasets.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,14 @@ func (r *DatasetRequests) Save(p *SaveParams, res *repo.DatasetRef) (err error)
456456
ds.Commit.Message = ""
457457
}
458458

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

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

0 commit comments

Comments
 (0)