Minor refactor for handling of LoggableDir (#3934)
Reuse existing Elements code to conceal information. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup #### Issue(s) * #3895 #### Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
f0425a0f9d
commit
dfbca1540d
@ -2,7 +2,6 @@ package path
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
|
|
||||||
@ -119,16 +118,8 @@ func (el Elements) Last() string {
|
|||||||
// LoggableDir takes in a path reference (of any structure) and conceals any
|
// LoggableDir takes in a path reference (of any structure) and conceals any
|
||||||
// non-standard elements (ids, filenames, foldernames, etc).
|
// non-standard elements (ids, filenames, foldernames, etc).
|
||||||
func LoggableDir(ref string) string {
|
func LoggableDir(ref string) string {
|
||||||
r := ref
|
// Can't directly use Builder since that could return an error. Instead split
|
||||||
n := strings.TrimSuffix(r, string(PathSeparator))
|
// into elements and use that.
|
||||||
|
split := Split(TrimTrailingSlash(ref))
|
||||||
for n != r {
|
return Elements(split).Conceal()
|
||||||
r = n
|
|
||||||
n = strings.TrimSuffix(r, string(PathSeparator))
|
|
||||||
}
|
|
||||||
|
|
||||||
elems := Split(r)
|
|
||||||
elems = pii.ConcealElements(elems, piiSafePathElems)
|
|
||||||
|
|
||||||
return join(elems)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user