-
Notifications
You must be signed in to change notification settings - Fork 0
Gate discovery route logs behind DEBUG #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,7 +123,9 @@ router.get('/about', (req, res) => { | |
| // Global discovery feed | ||
| router.get('/discover', async (req, res) => { | ||
| try { | ||
| console.log('Discover route accessed'); | ||
| if (process.env.DEBUG) { | ||
| console.log('Discover route accessed'); | ||
| } | ||
| // Validate and sanitize pagination params | ||
| const page = Math.max(1, parseInt(req.query.page) || 1); | ||
| const limit = Math.min(50, parseInt(req.query.limit) || 20); | ||
|
|
@@ -170,7 +172,9 @@ router.get('/discover', async (req, res) => { | |
|
|
||
| const totalPages = Math.ceil(Math.max(userCount, itemCount) / limit); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue: Inaccurate Pagination CalculationThe calculation of Recommended Solution: |
||
|
|
||
| console.log('Attempting to render discover template'); | ||
| if (process.env.DEBUG) { | ||
| console.log('Attempting to render discover template'); | ||
| } | ||
| res.render('discover', { | ||
| title: 'Discover - Wirebase', | ||
| updates, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Potential Parsing Error with
parseIntThe
parseIntfunction is used here without specifying a radix, which can lead to unexpected results if the input isn't strictly decimal. This is particularly risky when dealing with user input that could vary in format.Recommended Solution:
Always specify a radix when using
parseIntto ensure the parsing is done in the intended numeral system. For example: