More tuning and working on vacuum support

noticed a couple of stange things with vacuum

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2023-11-22 18:28:33 -05:00
parent a8ff2f5dee
commit 95338f2536
2 changed files with 6 additions and 4 deletions

View File

@@ -481,7 +481,7 @@ func TestDigitalOceanAsDocFromSHA(t *testing.T) {
} }
config.RemoteURLHandler = func(url string) (*http.Response, error) { config.RemoteURLHandler = func(url string) (*http.Response, error) {
request, _ := http.NewRequest(http.MethodGet, url, nil) request, _ := http.NewRequest(http.MethodGet, url, nil)
request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("GITHUB_TOKEN"))) request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("GH_PAT")))
return client.Do(request) return client.Do(request)
} }
} }
@@ -506,7 +506,7 @@ func TestDigitalOceanAsDocFromMain(t *testing.T) {
} }
config.Logger = slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{ config.Logger = slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelDebug, Level: slog.LevelError,
})) }))
if os.Getenv("GH_PAT") != "" { if os.Getenv("GH_PAT") != "" {

View File

@@ -100,10 +100,12 @@ func LocateRefNodeWithContext(ctx context.Context, root *yaml.Node, idx *index.S
if strings.HasPrefix(specPath, "http") { if strings.HasPrefix(specPath, "http") {
u, _ := url.Parse(specPath) u, _ := url.Parse(specPath)
p := "" p := ""
if u.Path != "" { if u.Path != "" && explodedRefValue[0] != "" {
p = filepath.Dir(u.Path) p = filepath.Dir(u.Path)
} }
if p != "" && explodedRefValue[0] != "" {
u.Path = filepath.Join(p, explodedRefValue[0]) u.Path = filepath.Join(p, explodedRefValue[0])
}
u.Fragment = "" u.Fragment = ""
rv = fmt.Sprintf("%s#%s", u.String(), explodedRefValue[1]) rv = fmt.Sprintf("%s#%s", u.String(), explodedRefValue[1])