Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Veld committed Aug 10, 2023
1 parent 2092871 commit 82c8106
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/config/resources/copy/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func (p *Provider) Init(cfg htypes.Resource, l logger.Logger) error {
}

p.config = c
p.log = l

return nil
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/config/resources/docs/provider_book.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ func (b *BookProvider) Create() error {
}

// capture the title of the page
title := slug
titleRegex, _ := regexp.Compile("^#(?P<title>.*)$>")
titleMatch := titleRegex.FindStringSubmatch(content)
title := titleMatch[1]
if len(titleMatch) > 0 {
title = titleMatch[1]
}

ip := IndexPage{
Title: title,
Expand Down
7 changes: 6 additions & 1 deletion pkg/server/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ func (a *API) validation(w http.ResponseWriter, r *http.Request) {

for _, c := range task.Conditions {
if c.Name == req.Condition {
fqrn, err := types.ParseFQRN(c.Target)
defaultTarget := task.Config.Target
if c.Target != "" {
defaultTarget = c.Target
}

fqrn, err := types.ParseFQRN(defaultTarget)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(err.Error())
Expand Down

0 comments on commit 82c8106

Please sign in to comment.