summaryrefslogtreecommitdiffstats
path: root/resources/image.go
diff options
context:
space:
mode:
Diffstat (limited to 'resources/image.go')
-rw-r--r--resources/image.go20
1 files changed, 5 insertions, 15 deletions
diff --git a/resources/image.go b/resources/image.go
index d46facac5..202b54fc2 100644
--- a/resources/image.go
+++ b/resources/image.go
@@ -21,7 +21,6 @@ import (
"image/draw"
"image/jpeg"
"io"
- "io/ioutil"
"os"
"strconv"
"strings"
@@ -126,8 +125,6 @@ type Image struct {
configInit sync.Once
configLoaded bool
- copyToDestinationInit sync.Once
-
imaging *Imaging
format imaging.Format
@@ -462,30 +459,23 @@ func (i *Image) decodeSource() (image.Image, error) {
return img, err
}
+// returns an opened file or nil if nothing to write.
func (i *Image) openDestinationsForWriting() (io.WriteCloser, error) {
targetFilenames := i.targetFilenames()
var changedFilenames []string
// Fast path:
- // This is a processed version of the original.
- // If it exists on destination with the same filename and file size, it is
- // the same file, so no need to transfer it again.
+ // This is a processed version of the original;
+ // check if it already existis at the destination.
for _, targetFilename := range targetFilenames {
- if fi, err := i.spec.BaseFs.PublishFs.Stat(targetFilename); err == nil && fi.Size() == i.osFileInfo.Size() {
+ if _, err := i.spec.BaseFs.PublishFs.Stat(targetFilename); err == nil {
continue
}
changedFilenames = append(changedFilenames, targetFilename)
}
if len(changedFilenames) == 0 {
- return struct {
- io.Writer
- io.Closer
- }{
- ioutil.Discard,
- ioutil.NopCloser(nil),
- }, nil
-
+ return nil, nil
}
return helpers.OpenFilesForWriting(i.spec.BaseFs.PublishFs, changedFilenames...)