Skip to content

Commit

Permalink
fix: temporary fix 500 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
blurfx authored Jan 9, 2024
1 parent 0e7f301 commit 36a055f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 10 additions & 6 deletions frontend/src/routes/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@
return html;
};
if (payload.language !== 'auto') {
if (calorLanguages.includes(calorRemap(payload.language))) {
value = calorHighlighter(payload.content, calorRemap(payload.language));
if (payload?.language == null) {
value = calorHighlighter(payload.content);
} else {
if (payload.language !== 'auto') {
if (calorLanguages.includes(calorRemap(payload.language))) {
value = calorHighlighter(payload.content, calorRemap(payload.language));
} else {
value = hljs.highlight(payload.content, { language: payload.language }).value;
}
} else {
value = hljs.highlight(payload.content, { language: payload.language }).value;
value = hljs.highlightAuto(payload.content).value;
}
} else {
value = hljs.highlightAuto(payload.content).value;
}
const lines = value.split(/\r?\n/);
const lineNumberWidth = 20 + lines.length.toString().length * 8;
Expand Down
8 changes: 6 additions & 2 deletions server/handlers/code/code.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package code

import (
"log"
"net"
"time"

"github.com/bbconfhq/ohmycodes/models"
"github.com/bbconfhq/ohmycodes/repository"
"github.com/go-playground/validator/v10"
"github.com/gofiber/fiber/v2"
gonanoid "github.com/matoous/go-nanoid/v2"
"net"
"time"
)

type Response struct {
Expand All @@ -26,6 +28,7 @@ func GetList(c *fiber.Ctx) error {
if err != nil {
status, errs = fiber.StatusInternalServerError, 1
result = nil
log.Printf("GetList error: %v", err)
}

return c.Status(status).JSON(Response{
Expand All @@ -42,6 +45,7 @@ func GetOne(c *fiber.Ctx) error {
if err != nil {
status, errs = fiber.StatusInternalServerError, 1
result = nil
log.Printf("GetOne error: %v", err)
}

return c.Status(status).JSON(Response{
Expand Down

0 comments on commit 36a055f

Please sign in to comment.