Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/loader/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func loadURL(ctx context.Context, cache *cache.Client, base *source, name string
}
}
}
if cachedKey.Path == "" {
cachedKey.Path = "."
}

if ok, err := cache.Get(ctx, cachedKey, &cachedValue); err != nil {
return nil, false, err
Expand Down
15 changes: 8 additions & 7 deletions pkg/sdkserver/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,21 +232,22 @@ func (s *server) load(w http.ResponseWriter, r *http.Request) {
logger.Debugf("parsing file: file=%s, content=%s", reqObject.File, reqObject.Content)

var (
prg types.Program
err error
cache = s.client.Cache
prg types.Program
err error

ctx = r.Context()
)

if reqObject.DisableCache {
cache = nil
ctx = cache.WithNoCache(ctx)
}

if reqObject.Content != "" {
prg, err = loader.ProgramFromSource(r.Context(), reqObject.Content, reqObject.SubTool, loader.Options{Cache: cache})
prg, err = loader.ProgramFromSource(ctx, reqObject.Content, reqObject.SubTool, loader.Options{Cache: s.client.Cache})
} else if reqObject.File != "" {
prg, err = loader.Program(r.Context(), reqObject.File, reqObject.SubTool, loader.Options{Cache: cache})
prg, err = loader.Program(ctx, reqObject.File, reqObject.SubTool, loader.Options{Cache: s.client.Cache})
} else {
prg, err = loader.ProgramFromSource(r.Context(), reqObject.ToolDefs.String(), reqObject.SubTool, loader.Options{Cache: cache})
prg, err = loader.ProgramFromSource(ctx, reqObject.ToolDefs.String(), reqObject.SubTool, loader.Options{Cache: s.client.Cache})
}
if err != nil {
writeError(logger, w, http.StatusInternalServerError, fmt.Errorf("failed to load program: %w", err))
Expand Down
Loading