FileVar uploads collide with REST run parameters
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
Research direction
Start at the REST run endpoint's multipart request handling and trace how uploaded file parts are separated from execution parameters. The report reproduces collisions for FileVar names commit and data; use its documented multipart requests to check both cases. Done means the endpoint accepts those uploads as variables, keeps run settings separate, and returns HTTP 201 with the file available to the Script.
Written by the indexing model from the issue text.
Description
Plugin Version
v0.0.1
NetBox Version
v4.7.3
Python Version
3.12
Steps to Reproduce
- Create a Script Project for uploaded files, upload the following Script, and activate its revision:
from netbox_scripts.scripts import FileVar, Script class TakesNamedFile(Script): commit = FileVar(label='Named file') def run(self, data, commit): return data['commit'].read().decode() - Create a small
notes.txtfile and request a run using the documented multipart format. Replace<id>with the Script's ID:printf 'hello\n' > notes.txt curl -i -sS -X POST \ -H "Authorization: Token $NETBOX_TOKEN" \ -F 'data={}' \ -F [email protected] \ 'https://netbox.example.com/api/plugins/netbox-scripts/scripts/<id>/run/'
Expected Behavior
The request returns HTTP 201 and queues the Script with the uploaded file in data['commit']. The file variable is kept separate from the run's commit setting.
The REST execution guide documents file parts named after their variables and separates variable values from execution parameters.
Observed Behavior
The request returns HTTP 400:
{"commit": ["Must be a valid boolean."]}
A FileVar named data, sent alongside the JSON data part, similarly returns:
{"data": ["Value must be valid JSON."]}
The endpoint reads the uploaded file as the top-level run parameter with the same name.
This affects request handling and is separate from the OpenAPI schema change in #16.
- Dominant language
- Python
- Stars
- 8
- Forks
- 0
- Avg merge
- 9h 34m
- Merged PRs (30d)
- 32
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from netbox-community/netbox-scripts
-
app: scripts status: backlog type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
netbox-community/netbox-scripts#80 ·
Maintainers usually reply within 1 day
-
Failed REST uploads expose internal error detailsPossibly taken @pheus claimed this 1 day ago. Openapp: scripts severity: medium status: accepted type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#77 · 1 assignee ·
Maintainers usually reply within 1 day
-
app: scripts severity: low status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
netbox-community/netbox-scripts#76 ·
Maintainers usually reply within 1 day
-
app: scripts severity: low status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
netbox-community/netbox-scripts#74 ·
Maintainers usually reply within 1 day
-
Correct the release checklist's tag and publishing stepsPossibly taken @pheus claimed this 7 days ago. Openapp: scripts status: accepted type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
netbox-community/netbox-scripts#68 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in netbox-community/netbox-scripts
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FinanceFlash/unvibecode#509 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
FAIRmat-NFDI/nomad-distro-dev#161 ·
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
modelcontextprotocol/python-sdk#3821 · 1 comment ·
Maintainers usually reply within 1 day
-
bug severity:low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Log-odds calibration uses upper middle score instead of median for even candidate setsPossibly taken @flysheep-ai claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day