lib: Get rid of buggy filesystem wrapping (#8257)
This commit is contained in:
+16
-10
@@ -123,21 +123,27 @@ func (r *caseFilesystemRegistry) cleaner() {
|
||||
|
||||
var globalCaseFilesystemRegistry = caseFilesystemRegistry{fss: make(map[fskey]*caseFilesystem)}
|
||||
|
||||
// caseFilesystem is a BasicFilesystem with additional checks to make a
|
||||
// potentially case insensitive underlying FS behave like it's case-sensitive.
|
||||
type caseFilesystem struct {
|
||||
Filesystem
|
||||
realCaser
|
||||
}
|
||||
|
||||
// NewCaseFilesystem ensures that the given, potentially case-insensitive filesystem
|
||||
// OptionDetectCaseConflicts ensures that the potentially case-insensitive filesystem
|
||||
// behaves like a case-sensitive filesystem. Meaning that it takes into account
|
||||
// the real casing of a path and returns ErrCaseConflict if the given path differs
|
||||
// from the real path. It is safe to use with any filesystem, i.e. also a
|
||||
// case-sensitive one. However it will add some overhead and thus shouldn't be
|
||||
// used if the filesystem is known to already behave case-sensitively.
|
||||
func NewCaseFilesystem(fs Filesystem) Filesystem {
|
||||
return wrapFilesystem(fs, globalCaseFilesystemRegistry.get)
|
||||
type OptionDetectCaseConflicts struct{}
|
||||
|
||||
func (o *OptionDetectCaseConflicts) apply(fs Filesystem) Filesystem {
|
||||
return globalCaseFilesystemRegistry.get(fs)
|
||||
}
|
||||
|
||||
func (o *OptionDetectCaseConflicts) String() string {
|
||||
return "detectCaseConflicts"
|
||||
}
|
||||
|
||||
// caseFilesystem is a BasicFilesystem with additional checks to make a
|
||||
// potentially case insensitive underlying FS behave like it's case-sensitive.
|
||||
type caseFilesystem struct {
|
||||
Filesystem
|
||||
realCaser
|
||||
}
|
||||
|
||||
func (f *caseFilesystem) Chmod(name string, mode FileMode) error {
|
||||
|
||||
Reference in New Issue
Block a user