mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-15 11:57:59 +00:00
New upstream version 1.3.0
This commit is contained in:
+6
-4
@@ -7,6 +7,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/corehandlers"
|
||||
@@ -15,11 +17,11 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/smira/go-aws-auth"
|
||||
)
|
||||
|
||||
const errCodeNotFound = "NotFound"
|
||||
|
||||
// PublishedStorage abstract file system with published files (actually hosted on S3)
|
||||
type PublishedStorage struct {
|
||||
s3 *s3.S3
|
||||
@@ -391,7 +393,7 @@ func (storage *PublishedStorage) SymLink(src string, dst string) error {
|
||||
|
||||
params := &s3.CopyObjectInput{
|
||||
Bucket: aws.String(storage.bucket),
|
||||
CopySource: aws.String(filepath.Join(storage.prefix, src)),
|
||||
CopySource: aws.String(filepath.Join(storage.bucket, storage.prefix, src)),
|
||||
Key: aws.String(filepath.Join(storage.prefix, dst)),
|
||||
ACL: aws.String(storage.acl),
|
||||
Metadata: map[string]*string{
|
||||
@@ -429,7 +431,7 @@ func (storage *PublishedStorage) FileExists(path string) (bool, error) {
|
||||
_, err := storage.s3.HeadObject(params)
|
||||
if err != nil {
|
||||
aerr, ok := err.(awserr.Error)
|
||||
if ok && aerr.Code() == s3.ErrCodeNoSuchKey {
|
||||
if ok && aerr.Code() == errCodeNotFound {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
type PublishedStorageSuite struct {
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package s3
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
@@ -634,7 +635,7 @@ func (objr objectResource) put(a *action) interface{} {
|
||||
var expectHash []byte
|
||||
if c := a.req.Header.Get("Content-MD5"); c != "" {
|
||||
var err error
|
||||
expectHash, err = hex.DecodeString(c)
|
||||
expectHash, err = base64.StdEncoding.DecodeString(c)
|
||||
if err != nil || len(expectHash) != md5.Size {
|
||||
fatalError(400, "InvalidDigest", "The Content-MD5 you specified was invalid")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user