Skip to content

Commit

Permalink
last one istg (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi authored Dec 12, 2024
2 parents e4012af + 692f44f commit 30b5d89
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions backend/internal/server/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,23 @@ func (s *Server) handleGetProjectDetails(c echo.Context) error {
// decode sections from json
var sections []map[string]interface{}
if project.Sections != nil {
if err := json.Unmarshal(project.Sections, &sections); err != nil {
sectionsBytes, ok := project.Sections.([]byte)
if !ok {
return echo.NewHTTPError(http.StatusInternalServerError, "invalid sections format")
}
if err := json.Unmarshal(sectionsBytes, &sections); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to parse sections")
}
}

// decode documents from json
var documents []map[string]interface{}
if project.Documents != nil {
if err := json.Unmarshal(project.Documents, &documents); err != nil {
documentsBytes, ok := project.Documents.([]byte)
if !ok {
return echo.NewHTTPError(http.StatusInternalServerError, "invalid documents format")
}
if err := json.Unmarshal(documentsBytes, &documents); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to parse documents")
}
}
Expand Down

0 comments on commit 30b5d89

Please sign in to comment.