This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin.git
The following commit(s) were added to refs/heads/master by this push:
new 524f3f2 fix: propagate policy parse errors in string adapter
524f3f2 is described below
commit 524f3f2dc9baef696d748db491d49b3055d359d1
Author: Yang Luo <[email protected]>
AuthorDate: Fri Sep 11 10:01:08 2026 +0800
fix: propagate policy parse errors in string adapter
---
persist/string-adapter/adapter.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/persist/string-adapter/adapter.go
b/persist/string-adapter/adapter.go
index 031f80b..ef63906 100644
--- a/persist/string-adapter/adapter.go
+++ b/persist/string-adapter/adapter.go
@@ -46,10 +46,13 @@ func (a *Adapter) LoadPolicy(model model.Model) error {
}
strs := strings.Split(a.Line, "\n")
for _, str := range strs {
+ str = strings.TrimSpace(str)
if str == "" {
continue
}
- _ = persist.LoadPolicyLine(str, model)
+ if err := persist.LoadPolicyLine(str, model); err != nil {
+ return err
+ }
}
return nil
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]