|
|
@ -563,18 +563,17 @@ func (fs *FSObjects) defaultFsJSON(object string) fsMetaV1 { |
|
|
|
// getObjectInfo - wrapper for reading object metadata and constructs ObjectInfo.
|
|
|
|
// getObjectInfo - wrapper for reading object metadata and constructs ObjectInfo.
|
|
|
|
func (fs *FSObjects) getObjectInfo(ctx context.Context, bucket, object string) (oi ObjectInfo, e error) { |
|
|
|
func (fs *FSObjects) getObjectInfo(ctx context.Context, bucket, object string) (oi ObjectInfo, e error) { |
|
|
|
fsMeta := fsMetaV1{} |
|
|
|
fsMeta := fsMetaV1{} |
|
|
|
|
|
|
|
if hasSuffix(object, slashSeparator) { |
|
|
|
|
|
|
|
// Since we support PUT of a "directory" object, we allow HEAD.
|
|
|
|
|
|
|
|
if !fsIsDir(ctx, pathJoin(fs.fsPath, bucket, object)) { |
|
|
|
|
|
|
|
return oi, errFileNotFound |
|
|
|
|
|
|
|
} |
|
|
|
fi, err := fsStatDir(ctx, pathJoin(fs.fsPath, bucket, object)) |
|
|
|
fi, err := fsStatDir(ctx, pathJoin(fs.fsPath, bucket, object)) |
|
|
|
if err != nil && err != errFileAccessDenied { |
|
|
|
if err != nil { |
|
|
|
return oi, err |
|
|
|
return oi, err |
|
|
|
} |
|
|
|
} |
|
|
|
if fi != nil { |
|
|
|
|
|
|
|
// If file found and request was with object ending with "/", consider it
|
|
|
|
|
|
|
|
// as directory and return object info
|
|
|
|
|
|
|
|
if hasSuffix(object, slashSeparator) { |
|
|
|
|
|
|
|
return fsMeta.ToObjectInfo(bucket, object, fi), nil |
|
|
|
return fsMeta.ToObjectInfo(bucket, object, fi), nil |
|
|
|
} |
|
|
|
} |
|
|
|
return oi, errFileNotFound |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fsMetaPath := pathJoin(fs.fsPath, minioMetaBucket, bucketMetaPrefix, bucket, object, fs.metaJSONFile) |
|
|
|
fsMetaPath := pathJoin(fs.fsPath, minioMetaBucket, bucketMetaPrefix, bucket, object, fs.metaJSONFile) |
|
|
|
// Read `fs.json` to perhaps contend with
|
|
|
|
// Read `fs.json` to perhaps contend with
|
|
|
@ -602,7 +601,7 @@ func (fs *FSObjects) getObjectInfo(ctx context.Context, bucket, object string) ( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Stat the file to get file size.
|
|
|
|
// Stat the file to get file size.
|
|
|
|
fi, err = fsStatFile(ctx, pathJoin(fs.fsPath, bucket, object)) |
|
|
|
fi, err := fsStatFile(ctx, pathJoin(fs.fsPath, bucket, object)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return oi, err |
|
|
|
return oi, err |
|
|
|
} |
|
|
|
} |
|
|
@ -664,7 +663,7 @@ func (fs *FSObjects) parentDirIsObject(ctx context.Context, bucket, parent strin |
|
|
|
if p == "." || p == "/" { |
|
|
|
if p == "." || p == "/" { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
if _, err := fsStatFile(ctx, pathJoin(fs.fsPath, bucket, p)); err == nil { |
|
|
|
if fsIsFile(ctx, pathJoin(fs.fsPath, bucket, p)) { |
|
|
|
// If there is already a file at prefix "p", return true.
|
|
|
|
// If there is already a file at prefix "p", return true.
|
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|