Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
fix: prevent modules with no published versions from crashing otf
Browse files Browse the repository at this point in the history
  • Loading branch information
robbert229 committed Sep 27, 2023
1 parent c1ee8d8 commit ab30471
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/http/html/static/templates/content/module_get.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
<div class="flex flex-col gap-2">
<label for="usage">Usage</label>
<textarea class="text-input font-normal font-mono" id="usage" cols="60" rows="5" readonly wrap="off">
module "{{ .Module.Name }}" {
source = "{{ .Hostname }}/{{ .Organization }}/{{ .Module.Name }}/{{ .Module.Provider }}"
version = "{{ .CurrentVersion.Version }}"
}
module "{{ .Module.Name }}" {
source = "{{ .Hostname }}/{{ .Organization }}/{{ .Module.Name }}/{{ .Module.Provider }}"
version = "{{ .CurrentVersion.Version }}"
}
</textarea>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion internal/module/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func (h *webHandlers) get(w http.ResponseWriter, r *http.Request) {

switch module.Status {
case ModuleStatusSetupComplete:
readme = html.MarkdownToHTML(tfmod.readme)
if tfmod != nil {
readme = html.MarkdownToHTML(tfmod.readme)
}
}

h.Render("module_get.tmpl", w, struct {
Expand Down

0 comments on commit ab30471

Please sign in to comment.