mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-06 21:13:24 +09:00
fix: restore missing blob file when re-publishing a package (#39239)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
co-authored by
wxiaoguang
parent
e4455fb494
commit
efa69e7230
@@ -4,11 +4,14 @@
|
||||
package packages
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"gitea.dev/modules/optional"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/modules/storage"
|
||||
"gitea.dev/modules/util"
|
||||
@@ -40,11 +43,15 @@ func (s *ContentStore) GetServeDirectURL(key BlobHash256Key, filename, method st
|
||||
return s.store.ServeDirectURL(KeyToRelativePath(key), filename, method, reqParams)
|
||||
}
|
||||
|
||||
// FIXME: Workaround to be removed in v1.20
|
||||
// https://github.com/go-gitea/gitea/issues/19586
|
||||
func (s *ContentStore) Has(key BlobHash256Key) error {
|
||||
_, err := s.store.Stat(KeyToRelativePath(key))
|
||||
return err
|
||||
func (s *ContentStore) OptionalSize(key BlobHash256Key) (sz optional.Option[int64], _ error) {
|
||||
st, err := s.store.Stat(KeyToRelativePath(key))
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return sz, nil
|
||||
}
|
||||
if err != nil {
|
||||
return sz, err
|
||||
}
|
||||
return optional.Some(st.Size()), nil
|
||||
}
|
||||
|
||||
// Save stores a package blob
|
||||
|
||||
Reference in New Issue
Block a user