mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-06 17:53:14 +08:00
@@ -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) {
|
||||
|
||||
15
cmd/mdmctl/apply_app_test.go
Normal file
15
cmd/mdmctl/apply_app_test.go
Normal file
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user