mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-19 13:53:02 -06:00
[chore] bump exif-terminator to 0.4.0 (#747)
This commit is contained in:
parent
91c8d5d20d
commit
2462c5fe22
5 changed files with 90 additions and 45 deletions
7
vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
generated
vendored
7
vendor/github.com/superseriousbusiness/exif-terminator/terminator.go
generated
vendored
|
|
@ -42,7 +42,7 @@ func Terminate(in io.Reader, fileSize int, mediaType string) (io.Reader, error)
|
|||
|
||||
switch mediaType {
|
||||
case "image/jpeg", "jpeg", "jpg":
|
||||
err = terminateJpeg(scanner, pipeWriter)
|
||||
err = terminateJpeg(scanner, pipeWriter, fileSize)
|
||||
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
|
||||
|
|
@ -65,10 +65,11 @@ func Terminate(in io.Reader, fileSize int, mediaType string) (io.Reader, error)
|
|||
return pipeReader, err
|
||||
}
|
||||
|
||||
func terminateJpeg(scanner *bufio.Scanner, writer io.WriteCloser) error {
|
||||
func terminateJpeg(scanner *bufio.Scanner, writer io.WriteCloser, expectedFileSize int) error {
|
||||
// jpeg visitor is where the spicy hack of streaming the de-exifed data is contained
|
||||
v := &jpegVisitor{
|
||||
writer: writer,
|
||||
writer: writer,
|
||||
expectedFileSize: expectedFileSize,
|
||||
}
|
||||
|
||||
// provide the visitor to the splitter so that it triggers on every section scan
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue