summaryrefslogtreecommitdiff
path: root/vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/superseriousbusiness/exif-terminator/terminator.go')
-rw-r--r--vendor/github.com/superseriousbusiness/exif-terminator/terminator.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/superseriousbusiness/exif-terminator/terminator.go b/vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
index 575bb1e42..9d9e6e743 100644
--- a/vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
+++ b/vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
@@ -43,6 +43,8 @@ func Terminate(in io.Reader, fileSize int, mediaType string) (io.Reader, error)
switch mediaType {
case "image/jpeg", "jpeg", "jpg":
err = terminateJpeg(scanner, pipeWriter, fileSize)
+ case "image/webp", "webp":
+ err = terminateWebp(scanner, pipeWriter)
case "image/png", "png":
// for pngs we need to skip the header bytes, so read them in
// and check we're really dealing with a png here
@@ -86,6 +88,18 @@ func terminateJpeg(scanner *bufio.Scanner, writer io.WriteCloser, expectedFileSi
return nil
}
+func terminateWebp(scanner *bufio.Scanner, writer io.WriteCloser) error {
+ v := &webpVisitor{
+ writer: writer,
+ }
+
+ // use the webp visitor's 'split' function, which satisfies the bufio.SplitFunc interface
+ scanner.Split(v.split)
+
+ scanAndClose(scanner, writer)
+ return nil
+}
+
func terminatePng(scanner *bufio.Scanner, writer io.WriteCloser) error {
ps := pngstructure.NewPngSplitter()