Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 backend: include path prefix in removal requests. #673

Merged
merged 1 commit into from
Nov 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions s3/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker) erro
func (storage *PublishedStorage) Remove(path string) error {
params := &s3.DeleteObjectInput{
Bucket: aws.String(storage.bucket),
Key: aws.String(path),
Key: aws.String(filepath.Join(storage.prefix,path)),
}
_, err := storage.s3.DeleteObject(params)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, storage))
}
}

if storage.plusWorkaround && strings.Contains(path, "+") {
// try to remove workaround version, but don't care about result
Expand Down
7 changes: 7 additions & 0 deletions s3/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ func (s *PublishedStorageSuite) TestRemove(c *C) {
c.Check(err, IsNil)

s.AssertNoFile(c, "a/b")

s.PutFile(c, "lala/xyz", []byte("test"))

errp := s.prefixedStorage.Remove("xyz")
c.Check(errp, IsNil)

s.AssertNoFile(c, "lala/xyz")
}

func (s *PublishedStorageSuite) TestRemovePlusWorkaround(c *C) {
Expand Down