Assume that item has no attachments if there is no body (#2911)
Some response from the Graph API was returning empty body. This could be something left over from older version of the platform, but this causes issues in our codebase. <!-- PR description--> --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
d390aaae40
commit
7a7933e54c
@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased] (beta)
|
||||
|
||||
### Fixed
|
||||
- Fixed permissions restore in latest backup version
|
||||
- Fixed permissions restore in latest backup version.
|
||||
- Incremental OneDrive backups could panic if the delta token expired and a folder was seen and deleted in the course of item enumeration for the backup.
|
||||
- Incorrectly moving subfolder hierarchy from a deleted folder to a new folder at the same path during OneDrive incremental backup.
|
||||
- Handle calendar events with no body.
|
||||
|
||||
## [v0.6.1] (beta) - 2023-03-21
|
||||
|
||||
|
||||
@ -135,6 +135,10 @@ func checkIDAndName(c graph.Container) error {
|
||||
}
|
||||
|
||||
func HasAttachments(body models.ItemBodyable) bool {
|
||||
if body == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if ct, ok := ptr.ValOK(body.GetContentType()); !ok || ct == models.TEXT_BODYTYPE {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -208,6 +208,13 @@ func (suite *ExchangeServiceSuite) TestHasAttachments() {
|
||||
return body
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "No body",
|
||||
hasAttachment: assert.False,
|
||||
getBodyable: func(t *testing.T) models.ItemBodyable {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user