mirror of
https://github.com/stashapp/stash.git
synced 2026-05-03 20:32:26 +02:00
Fix image memory issue (#935)
* Return slim images from mutations * Fix potential memory leaks
This commit is contained in:
parent
ceb888958e
commit
beb84b8e94
3 changed files with 9 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ mutation ImageUpdate(
|
|||
performer_ids: $performer_ids,
|
||||
tag_ids: $tag_ids
|
||||
}) {
|
||||
...ImageData
|
||||
...SlimImageData
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,13 +38,13 @@ mutation BulkImageUpdate(
|
|||
performer_ids: $performer_ids,
|
||||
tag_ids: $tag_ids
|
||||
}) {
|
||||
...ImageData
|
||||
...SlimImageData
|
||||
}
|
||||
}
|
||||
|
||||
mutation ImagesUpdate($input : [ImageUpdateInput!]!) {
|
||||
imagesUpdate(input: $input) {
|
||||
...ImageData
|
||||
...SlimImageData
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,11 +90,15 @@ func openSourceImage(path string) (io.ReadCloser, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// defer closing of zip to the calling function, unless an error
|
||||
// is returned, in which case it should be closed immediately
|
||||
|
||||
// find the file matching the filename
|
||||
for _, f := range r.File {
|
||||
if f.Name == filename {
|
||||
src, err := f.Open()
|
||||
if err != nil {
|
||||
r.Close()
|
||||
return nil, err
|
||||
}
|
||||
return &imageReadCloser{
|
||||
|
|
@ -104,6 +108,7 @@ func openSourceImage(path string) (io.ReadCloser, error) {
|
|||
}
|
||||
}
|
||||
|
||||
r.Close()
|
||||
return nil, fmt.Errorf("file with name '%s' not found in zip file '%s'", filename, zipFilename)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ func walkGalleryZip(path string, walkFunc func(file *zip.File) error) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer readCloser.Close()
|
||||
|
||||
for _, file := range readCloser.File {
|
||||
if file.FileInfo().IsDir() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue