Ensure that leading slash is added to package's original path. Fixes #18.

This commit is contained in:
Stanislav Nikitin 2019-10-22 04:13:27 +05:00
parent 5acc64de59
commit 68ad99b767
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE

View File

@ -56,6 +56,12 @@ func SetPackage(args []string, options map[string]string) {
VCS: args[3], VCS: args[3],
} }
// Execute some necessary checks.
// If package's original path isn't starting with "/" - add it.
if !strings.HasPrefix(pkg.OriginalPath, "/") {
pkg.OriginalPath = "/" + pkg.OriginalPath
}
log.Info().Str("description", pkg.Description).Str("original path", pkg.OriginalPath).Str("real path", pkg.RealPath).Str("VCS", pkg.VCS).Msg("Sending set/update request to giredored...") log.Info().Str("description", pkg.Description).Str("original path", pkg.OriginalPath).Str("real path", pkg.RealPath).Str("VCS", pkg.VCS).Msg("Sending set/update request to giredored...")
url := "http://" + options["server"] + "/_api/packages" url := "http://" + options["server"] + "/_api/packages"