Skip to content

Commit 4a5f6fa

Browse files
authored
fix(cos): [137308423] tencentcloud_cos_bucket optimize acl_body verification logic (#3177)
* add * add
1 parent ab13014 commit 4a5f6fa

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changelog/3177.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_cos_bucket: optimize `acl_body` verification logic
3+
```

tencentcloud/services/cos/resource_tc_cos_bucket.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,9 +1963,14 @@ func ACLBodyDiffFunc(olds, news string, d *schema.ResourceData) (result bool) {
19631963
newOwnerId := newOwner.SelectElement("ID")
19641964
newOwnerName := newOwner.SelectElement("DisplayName")
19651965

1966+
if oldOwnerId == nil || newOwnerId == nil {
1967+
log.Println("[CRITAL]oldOwnerId or newOwnerId is nil: return false.")
1968+
return false
1969+
}
1970+
19661971
// diff: Owner element
1967-
if oldOwnerId.Text() != newOwnerId.Text() || oldOwnerName.Text() != newOwnerName.Text() {
1968-
log.Printf("[CRITAL]OwnerId[old:%s, new:%s] or OwnerName[old:%s, new:%s] not equal: return false.\n", oldOwnerId.Text(), newOwnerId.Text(), oldOwnerName.Text(), newOwnerName.Text())
1972+
if oldOwnerId.Text() != newOwnerId.Text() {
1973+
log.Printf("[CRITAL]OwnerId[old:%s, new:%s] not equal: return false.\n", oldOwnerId.Text(), newOwnerId.Text())
19691974
return false
19701975
}
19711976

0 commit comments

Comments
 (0)