refactor: replace Azure Blob SDK with a REST client (#39315)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-09-16 17:06:00 +02:00
committed by GitHub
co-authored by wxiaoguang
parent f0a535b641
commit c6c671e113
12 changed files with 520 additions and 455 deletions
+4 -32
View File
@@ -39,7 +39,7 @@ func (m *minioObject) Stat() (os.FileInfo, error) {
return nil, convertMinioErr(err)
}
return &minioFileInfo{oi}, nil
return &objectFileInfo{path.Base(oi.Key), oi.Size, oi.LastModified}, nil
}
// minio reports a missing key on the first Read, ReadAt or Seek rather than on Open, so all
@@ -234,46 +234,18 @@ func (m *MinioStorage) Save(path string, r io.Reader, size int64) (int64, error)
return uploadInfo.Size, nil
}
type minioFileInfo struct {
minio.ObjectInfo
}
func (m minioFileInfo) Name() string {
return path.Base(m.ObjectInfo.Key)
}
func (m minioFileInfo) Size() int64 {
return m.ObjectInfo.Size
}
func (m minioFileInfo) ModTime() time.Time {
return m.LastModified
}
func (m minioFileInfo) IsDir() bool {
return strings.HasSuffix(m.ObjectInfo.Key, "/")
}
func (m minioFileInfo) Mode() os.FileMode {
return os.ModePerm
}
func (m minioFileInfo) Sys() any {
return nil
}
// Stat returns the stat information of the object
func (m *MinioStorage) Stat(path string) (os.FileInfo, error) {
func (m *MinioStorage) Stat(p string) (os.FileInfo, error) {
info, err := m.client.StatObject(
m.ctx,
m.bucket,
m.buildMinioPath(path),
m.buildMinioPath(p),
minio.StatObjectOptions{},
)
if err != nil {
return nil, convertMinioErr(err)
}
return &minioFileInfo{info}, nil
return &objectFileInfo{path.Base(info.Key), info.Size, info.LastModified}, nil
}
// Delete delete a file