fix(dbfs): enforce root protection for single file share

This commit is contained in:
Aaron Liu
2025-04-21 19:43:09 +08:00
parent d60e400f83
commit 7b5e0e8581
11 changed files with 32 additions and 17 deletions

View File

@@ -25,6 +25,7 @@ type dbfsOption struct {
noChainedCreation bool
streamListResponseCallback func(parent fs.File, file []fs.File)
ancestor *File
notRoot bool
}
func newDbfsOption() *dbfsOption {
@@ -56,6 +57,13 @@ func WithFilePublicMetadata() fs.Option {
})
}
// WithNotRoot force the get result cannot be a root folder
func WithNotRoot() fs.Option {
return optionFunc(func(o *dbfsOption) {
o.notRoot = true
})
}
// WithContextHint enables generating context hint for the list operation.
func WithContextHint() fs.Option {
return optionFunc(func(o *dbfsOption) {