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 (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"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
|
||||
// non-standard elements (ids, filenames, foldernames, etc).
|
||||
func LoggableDir(ref string) string {
|
||||
r := ref
|
||||
n := strings.TrimSuffix(r, string(PathSeparator))
|
||||
|
||||
for n != r {
|
||||
r = n
|
||||
n = strings.TrimSuffix(r, string(PathSeparator))
|
||||
}
|
||||
|
||||
elems := Split(r)
|
||||
elems = pii.ConcealElements(elems, piiSafePathElems)
|
||||
|
||||
return join(elems)
|
||||
// Can't directly use Builder since that could return an error. Instead split
|
||||
// into elements and use that.
|
||||
split := Split(TrimTrailingSlash(ref))
|
||||
return Elements(split).Conceal()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user