sanitize.go
func isPathSafe(s string) error {
	u, err := url.Parse(s)
	if err != nil {
		return err
	}

	e, err := url.PathUnescape(u.Path)
	if err != nil {
		return err
	}

	if strings.Contains(e, "..") {
		return fmt.Errorf(errorMessage)
	}

	if !whitelistPattern.MatchString(e) {
		return fmt.Errorf(errorMessage)
	}

	return nil
}
func isPathSafe(s string) error {
	u, err := url.Parse(s)
	if err != nil {
		return err
	}

	e, err := url.PathUnescape(u.Path)
	if err != nil {
		return err
	}

	if strings.Contains(e, "..") {
		return fmt.Errorf(errorMessage)
	}

	if !whitelistPattern.MatchString(e) {
		return fmt.Errorf(errorMessage)
	}

	return nil
}
// isPathSafe checks if the passed in path conforms to a whitelist.