mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
24 lines
595 B
Go
24 lines
595 B
Go
// Package storage provides functionalities to interact with the storage system (filesystem).
|
|
package storage
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
// PathValidationError represents a path validation error (e.g., path traversal attempt)
|
|
type PathValidationError struct {
|
|
Path string
|
|
Message string
|
|
}
|
|
|
|
func (e *PathValidationError) Error() string {
|
|
return fmt.Sprintf("%s: %s", e.Message, e.Path)
|
|
}
|
|
|
|
// IsPathValidationError checks if the error is a PathValidationError
|
|
func IsPathValidationError(err error) bool {
|
|
var pathErr *PathValidationError
|
|
return err != nil && errors.As(err, &pathErr)
|
|
}
|