Skip to content

Commit

Permalink
fix(publish): api publish endpoint and CanonicalizeDatasetRef fix
Browse files Browse the repository at this point in the history
- api publish endpoint needs to check if the dataset should or should not be pinned
- CanonicalizeDatasetRef needs to pass over the Published status of the on file dataset ref
  • Loading branch information
ramfox committed Dec 10, 2018
1 parent e1d1d9f commit 75077cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ import (
)

var log = golog.Logger("actions")

func init() {
golog.SetLogLevel("actions", "info")
}
5 changes: 3 additions & 2 deletions api/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ func (h DatasetHandlers) publishHandler(w http.ResponseWriter, r *http.Request,

ref.Published = publish
p := &lib.SetPublishStatusParams{
Ref: &ref,
UpdateRegistry: r.FormValue("no_registry") != "true",
Ref: &ref,
UpdateRegistry: r.FormValue("no_registry") != "true",
UpdateRegistryPin: r.FormValue("no_pin") != "true",
}
var ok bool
if err := h.DatasetRequests.SetPublishStatus(p, &ok); err != nil {
Expand Down
1 change: 1 addition & 0 deletions repo/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ func CanonicalizeDatasetRef(r Repo, ref *DatasetRef) error {
if ref.Peername == "" {
ref.Peername = got.Peername
}
ref.Published = got.Published
if ref.Path != got.Path || ref.ProfileID != got.ProfileID || ref.Name != got.Name || ref.Peername != got.Peername {
return fmt.Errorf("Given datasetRef %s does not match datasetRef on file: %s", ref.String(), got.String())
}
Expand Down

0 comments on commit 75077cf

Please sign in to comment.