Skip to content
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

Bulk rename improperly strips "find" and "replace" fields #13791

Closed
pv2b opened this issue Sep 17, 2023 · 1 comment · Fixed by #13793
Closed

Bulk rename improperly strips "find" and "replace" fields #13791

pv2b opened this issue Sep 17, 2023 · 1 comment · Fixed by #13793
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@pv2b
Copy link
Contributor

pv2b commented Sep 17, 2023

NetBox version

v3.6.1

Python version

3.11

Steps to Reproduce

  1. On an existing device, create an interface labeled something like "One Two".
  2. Go to the interface tab of that device, check the checkbox next to it and hit "rename".
  3. In the find field, enter "One " (note the trailing space!). In the replacement field enter "One-".
  4. Click the preview button.

Expected Behavior

NetBox should offer to rename the device to "One-Two".

Observed Behavior

Netbox offers to rename the device to "One- Two" (note the space).

My guess (I've not looked at the code) is that this happens because django autostrips whitespace from input fields by default, and this needs to be disabled.

Also, the same bug exists on the "replace" field, and is completely analagous to the replace field.

Workaround: For the "find" field, use regex mode and \s to match trailing whitespace. For the "replace" field, I don't know of a general workaround.

@pv2b pv2b added the type: bug A confirmed report of unexpected behavior in the application label Sep 17, 2023
@pv2b
Copy link
Contributor Author

pv2b commented Sep 17, 2023

I'm happy to volunteer to look at the code to fix this issue with a PR.

@abhi1693 abhi1693 added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Sep 17, 2023
pv2b added a commit to pv2b/netbox that referenced this issue Sep 17, 2023
pv2b added a commit to pv2b/netbox that referenced this issue Sep 17, 2023
jeremystretch pushed a commit that referenced this issue Sep 18, 2023
* Add test for bug #13791
#13791

* Fix #13791 by disabling striping on find and replace fields of BulkRenameForm
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants