[PR #18860] [MERGED] Fixes #18838: Correctly reject invalid falsy local context data #15457

Closed
opened 2025-12-30 00:22:02 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18860
Author: @fabi125
Created: 3/10/2025
Status: Merged
Merged: 3/11/2025
Merged by: @jnovinger

Base: mainHead: 18838


📝 Commits (2)

  • a6eb2d0 Correctly reject invalid falsy local context data.
  • 4cbb17d move tests

📊 Changes

2 files changed (+29 additions, -1 deletions)

View changed files

📝 netbox/extras/models/configs.py (+1 -1)
📝 netbox/extras/tests/test_models.py (+28 -0)

📄 Description

Fixes: #18838

Reject falsy values like the empty string, 0 or False as local context data.

I verified that None/null still works as expected and that an empty string in UI gets correctly converted to None before clean() is called.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18860 **Author:** [@fabi125](https://github.com/fabi125) **Created:** 3/10/2025 **Status:** ✅ Merged **Merged:** 3/11/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `18838` --- ### 📝 Commits (2) - [`a6eb2d0`](https://github.com/netbox-community/netbox/commit/a6eb2d0103220d251c4f4f7dc33f849cb2d272fc) Correctly reject invalid falsy local context data. - [`4cbb17d`](https://github.com/netbox-community/netbox/commit/4cbb17d2e35e971b88906745ebef9cf7b628ac2d) move tests ### 📊 Changes **2 files changed** (+29 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/models/configs.py` (+1 -1) 📝 `netbox/extras/tests/test_models.py` (+28 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #18838 Reject falsy values like the empty string, 0 or False as local context data. I verified that `None`/`null` still works as expected and that an empty string in UI gets correctly converted to `None` before `clean()` is called. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:22:02 +01:00
adam closed this issue 2025-12-30 00:22:03 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15457