Skip to content

Commit

Permalink
fix corner cases for wrong parsing RBAC name, during resolve conflict…
Browse files Browse the repository at this point in the history
… for complex multi line RBAC objects, fix #976
  • Loading branch information
Slach committed Aug 6, 2024
1 parent 9c51529 commit 2056eb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v2.5.25
BUG FIXES
- fix corner cases for wrong parsing RBAC name, during resolve conflict for complex multi line RBAC objects, fix [976](https://github.com/Altinity/clickhouse-backup/issues/976)

# v2.5.24
BUG FIXES
- fix corner cases object disk parse endpoint for S3, to avoid wrong `.amazonaws.amazonaws.com` suffix
Expand Down
6 changes: 5 additions & 1 deletion pkg/backup/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,11 @@ func (b *Backuper) detectRBACObject(sql string) (string, string, error) {
if strings.HasPrefix(sql, prefix) {
kind = k
// Extract the name from the SQL query.
name = strings.TrimSpace(strings.TrimPrefix(sql, prefix))
if semicolonIdx := strings.Index(sql, ";"); semicolonIdx >= 0 {
name = strings.TrimSpace(strings.TrimPrefix(sql[:semicolonIdx], prefix))
} else {
name = strings.TrimSpace(strings.TrimPrefix(sql, prefix))
}
break
}
}
Expand Down

0 comments on commit 2056eb3

Please sign in to comment.