fix: restore missing blob file when re-publishing a package (#39239)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Huang-404-Q
2026-09-05 10:33:36 +02:00
committed by GitHub
co-authored by wxiaoguang
parent e4455fb494
commit efa69e7230
10 changed files with 145 additions and 76 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"net/http"
"net/url"
"os"
@@ -108,7 +109,7 @@ func convertAzureBlobErr(err error) error {
}
if bloberror.HasCode(err, bloberror.BlobNotFound) {
return os.ErrNotExist
return fs.ErrNotExist
}
var respErr *azcore.ResponseError
if !errors.As(err, &respErr) {
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"net/url"
"os"
"path/filepath"
@@ -138,7 +139,7 @@ func (l *LocalStorage) ServeDirectURL(path, name, _ string, reqParams *ServeDire
}
func (l *LocalStorage) normalizeWalkError(err error) error {
if errors.Is(err, os.ErrNotExist) {
if errors.Is(err, fs.ErrNotExist) {
// ignore it because the file may be deleted during the walk, and we don't care about it
return nil
}
+2 -1
View File
@@ -4,6 +4,7 @@
package storage
import (
"io/fs"
"os"
"strings"
"testing"
@@ -72,7 +73,7 @@ func TestLocalStorageDelete(t *testing.T) {
if exists {
require.NoError(t, err)
} else {
require.ErrorIs(t, err, os.ErrNotExist)
require.ErrorIs(t, err, fs.ErrNotExist)
}
}
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"net/http"
"net/url"
"os"
@@ -87,9 +88,9 @@ func convertMinioErr(err error, optMsg ...string) error {
// Convert two responses to standard analogues
switch errResp.Code {
case "NoSuchKey":
return wrapErr(os.ErrNotExist)
return wrapErr(fs.ErrNotExist)
case "AccessDenied":
return wrapErr(os.ErrPermission)
return wrapErr(fs.ErrPermission)
}
return wrapErr(err)