Do not delete asset name if update request does not have a name#18470
Merged
snipe merged 1 commit intogrokability:developfrom Feb 9, 2026
Merged
Do not delete asset name if update request does not have a name#18470snipe merged 1 commit intogrokability:developfrom
snipe merged 1 commit intogrokability:developfrom
Conversation
snipe
reviewed
Jan 22, 2026
| // Using `->has` preserves the asset name if the name parameter was not included in request. | ||
| $asset_name = request()->has('name') ? request('name') : $asset->name; | ||
|
|
||
| $asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), '', 'Checked out on asset update', $asset_name, $location); |
Member
There was a problem hiding this comment.
Do we need to escape that as we were before (via e()) or is it escaped elsewhere?
Contributor
Author
There was a problem hiding this comment.
Don't have a clue.
I've copied the code from checkout() later on.
If it needs to be escaped it probably has to be escaped in both places.
Also I'm not sure what is better
request('name')
vs
$request->input('name')
vs
$request->get('name')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17770 which still exists.
Upon update of an asset, if the request does not have a 'name', the old name is deleted.
Perform the same check as in checkout()
https://github.com/bilias/snipe-it/blob/2a8ebd2212de9023ec8296b929276a02b0dac9fd/app/Http/Controllers/Api/AssetsController.php#L970-L984