github.com/blend/go-sdk@v1.20220411.3/sanitize/path_sanitizer.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package sanitize
     9  
    10  // PathSanitizer is a type that can sanitize a url path.
    11  type PathSanitizer interface {
    12  	SanitizePath(path string) string
    13  }
    14  
    15  // PathSanitizerFunc implements PathSanitizer.
    16  type PathSanitizerFunc func(path string) string
    17  
    18  // SanitizePath implements PathSanitizer.
    19  func (psf PathSanitizerFunc) SanitizePath(path string) string {
    20  	return psf(path)
    21  }
    22  
    23  // DefaultPathSanitizerFunc is a default implementation of a path
    24  // sanitizer func that just returns the original path.
    25  func DefaultPathSanitizerFunc(p string) string { return p }