diff --git a/cmd/mdmctl/apply_app.go b/cmd/mdmctl/apply_app.go index d85002c1..8683de9d 100644 --- a/cmd/mdmctl/apply_app.go +++ b/cmd/mdmctl/apply_app.go @@ -169,7 +169,10 @@ func (cmd *applyCommand) serverRepoURL() (string, error) { } func pkgURL(repoURL, pkgPath string) string { - return path.Join(repoURL, filepath.Base(pkgPath)) + u, _ := url.Parse(repoURL) + newPath := path.Join(u.Path, filepath.Base(pkgPath)) + u.Path = newPath + return u.String() } func repoURL(server string) (string, error) { diff --git a/cmd/mdmctl/apply_app_test.go b/cmd/mdmctl/apply_app_test.go new file mode 100644 index 00000000..ab2b09c0 --- /dev/null +++ b/cmd/mdmctl/apply_app_test.go @@ -0,0 +1,15 @@ +package main + +import ( + "testing" +) + +func TestPkgURL(t *testing.T) { + baseURL := "https://mdm.acme.co/repo" + pkgPath := "/Users/user/Desktop/dep_pkg-foo_1.1.pkg" + u := pkgURL(baseURL, pkgPath) + if have, want := u, "https://mdm.acme.co/repo/dep_pkg-foo_1.1.pkg"; have != want { + t.Errorf("have %s, want %s", have, want) + } + +}