mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-03 10:43:58 +02:00
Merge branch 'master' into version/3
This commit is contained in:
commit
bca4bddf53
@ -29,7 +29,7 @@ The source URL can be provided as is, prepended by `/plain/` part:
|
||||
/plain/http://example.com/images/curiosity.jpg
|
||||
```
|
||||
|
||||
**📝Note:** If the sorce URL contains query string or `@`, you need to escape it.
|
||||
**📝Note:** If the source URL contains query string or `@`, you need to escape it.
|
||||
|
||||
#### Base64 encoded
|
||||
|
||||
@ -67,7 +67,7 @@ imgproxy responses with JSON body and returns the following info:
|
||||
}
|
||||
```
|
||||
|
||||
#### Exampple (mp4)
|
||||
#### Example (mp4)
|
||||
|
||||
```json
|
||||
{
|
||||
|
18
download.go
18
download.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
@ -196,7 +197,22 @@ func downloadImage(imageURL string) (*imageData, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imgdata, err := readAndCheckImage(res.Body, int(res.ContentLength))
|
||||
body := res.Body
|
||||
contentLength := int(res.ContentLength)
|
||||
|
||||
if res.Header.Get("Content-Encoding") == "gzip" {
|
||||
gzipBody, errGzip := gzip.NewReader(res.Body)
|
||||
if gzipBody != nil {
|
||||
defer gzipBody.Close()
|
||||
}
|
||||
if errGzip != nil {
|
||||
return nil, err
|
||||
}
|
||||
body = gzipBody
|
||||
contentLength = 0
|
||||
}
|
||||
|
||||
imgdata, err := readAndCheckImage(body, contentLength)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -210,8 +210,6 @@ func heifReadBoxes(d *heifData, r io.Reader) error {
|
||||
if w > d.Width || h > d.Height {
|
||||
d.Width, d.Height = w, h
|
||||
}
|
||||
case "mdat":
|
||||
return errors.New("mdat box occurred before meta box")
|
||||
default:
|
||||
if err := heifDiscardN(r, boxDataSize); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user