mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
API returns error when Note lacks attachment #4482
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#4482
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tsummerer on GitHub (Feb 3, 2021).
API returns error when Note lacks attachment
Issue
When doing a Patch of a Note record - if your client has the
filenameattribute present, then the application assumes that you're trying to upload a file. It assumes this even if thefilenameis empty. An empty attribute causes the endpoint to throw an exception and return an error to the client.When you
GETa Note bean, it returns thefilenameattribute as an empty string (if there is no file). It is not uncommon for a client to return that same object for aPATCH- so the application should not fail if this attribute is blank.This is not a special field type - it should probably not be the trigger to initiate an upload and it certainly should accept blank values.
Error introduced by #8408
Expected Behavior
If you
PATCHa Note with a blankfilename, the request should not fail.Actual Behavior
If you
PATCHa Note with a blankfilename, the application tries to do a file upload and fails when it cannot interpret the filename.Examples:
GET a Note:
If your client edits the description and tries to pass the object back to the API, it will fail
Response:
Possible Fix
At a minimum, line
378in ModuleService.php should have a!empty()condition addedSteps to Reproduce
filenameas a blank stringContext
Our mobile app builds objects based on vardefs. It uses these objects when communicating with the API. It's unable to edit Notes that do not have attachments because Suite won't accept a blank
filenameYour Environment