mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
bashing through usecases and updating tests as we go.
so many things that can go wrong. have to catch them all. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
type LocalFS struct {
|
||||
indexConfig *SpecIndexConfig
|
||||
entryPointDirectory string
|
||||
baseDirectory string
|
||||
Files map[string]RolodexFile
|
||||
@@ -28,7 +29,18 @@ func (l *LocalFS) GetFiles() map[string]RolodexFile {
|
||||
return l.Files
|
||||
}
|
||||
|
||||
func (l *LocalFS) GetErrors() []error {
|
||||
return l.readingErrors
|
||||
}
|
||||
|
||||
func (l *LocalFS) Open(name string) (fs.File, error) {
|
||||
|
||||
if l.indexConfig != nil && !l.indexConfig.AllowFileLookup {
|
||||
return nil, &fs.PathError{Op: "open", Path: name,
|
||||
Err: fmt.Errorf("file lookup for '%s' not allowed, set the index configuration "+
|
||||
"to AllowFileLookup to be true", name)}
|
||||
}
|
||||
|
||||
if !filepath.IsAbs(name) {
|
||||
var absErr error
|
||||
name, absErr = filepath.Abs(filepath.Join(l.baseDirectory, name))
|
||||
|
||||
Reference in New Issue
Block a user