Merge pull request #697 from pjediny/issues-692

Issues 692
This commit is contained in:
Andrey Smirnov
2018-02-09 23:26:09 +03:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -29,4 +29,5 @@ List of contributors, in chronological order:
* Clemens Rabe (https://github.com/seeraven)
* TJ Merritt (https://github.com/tjmerritt)
* Matt Martyn (https://github.com/MMartyn)
* Ludovico Cavedon (https://github.com/cavedon)
* Ludovico Cavedon (https://github.com/cavedon)
* Petr Jediny (https://github.com/pjediny)

View File

@@ -20,6 +20,8 @@ import (
"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
}