Skip to content

Commit

Permalink
THEMES-1900: Fix logic for detecting 404 for sectionId/_id (#2106)
Browse files Browse the repository at this point in the history
* THEMES-1900: Fix logic for detecting 404 for sectionId/_id

* fix format

* Fix results for hierarchy queries
  • Loading branch information
nschubach authored Apr 26, 2024
1 parent 03caedf commit d9a7dcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ export default {
sectionId: "text",
},
transform: (data, query) => {
let idMatch = false;
if (query.sectionId) {
idMatch = data._id !== query.sectionId;
}

if ((!query.hierarchy && idMatch) || (query.uri && idMatch)) {
if (query.sectionId && query.sectionId !== data._id) {
const error = new Error("Not found");
error.statusCode = 404;
throw error;
}

return data;
},
};

0 comments on commit d9a7dcb

Please sign in to comment.