Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageInput not cleaning up object urls #681

Closed
s-nel opened this issue May 17, 2017 · 1 comment
Closed

ImageInput not cleaning up object urls #681

s-nel opened this issue May 17, 2017 · 1 comment

Comments

@s-nel
Copy link

s-nel commented May 17, 2017

The dropzone library documentation states that

You need to destroy the object URL yourself whenever you don't need the preview by calling window.URL.revokeObjectURL(file.preview) to avoid memory leaks.

Currently ImageInput is not revoking urls.

I think admin-on-rest should take care of this because onRemove is not exposed to clients, so it would be more difficult for clients to perform this cleanup for themselves.

I suggest adding object url cleanup to the onRemove() method of ImageInput and adding cleanup when ImageInput is unmounted.

djhi added a commit that referenced this issue May 19, 2017
- [x] Refactored the existing ImageInput into FileInput (but kept an exported ImageInput component in order to not break backward compatibilty)
- [x] Added a new `FileField` component (similar to `ImageField` but displays a link instead of an image)
- [x] `FileField` and `ImageField` can handle array sources now
- [x] `FileField` and `ImageField` now have access to the raw [File](https://developer.mozilla.org/en/docs/Web/API/File) object for newly dropped files (Fix #680)
- [x] Cleans up URLs generated for preview (Fixes #681)
- [ ] Tests
@djhi djhi mentioned this issue May 19, 2017
6 tasks
djhi added a commit that referenced this issue May 24, 2017
- [x] Refactored the existing ImageInput into FileInput (but kept an exported ImageInput component in order to not break backward compatibilty)
- [x] Added a new `FileField` component (similar to `ImageField` but displays a link instead of an image)
- [x] `FileField` and `ImageField` can handle array sources now
- [x] `FileField` and `ImageField` now have access to the raw [File](https://developer.mozilla.org/en/docs/Web/API/File) object for newly dropped files (Fix #680)
- [x] Cleans up URLs generated for preview (Fixes #681)
- [ ] Tests
djhi added a commit that referenced this issue May 24, 2017
- [x] Refactored the existing ImageInput into FileInput (but kept an exported ImageInput component in order to not break backward compatibilty)
- [x] Added a new `FileField` component (similar to `ImageField` but displays a link instead of an image)
- [x] `FileField` and `ImageField` can handle array sources now
- [x] `FileField` and `ImageField` now have access to the raw [File](https://developer.mozilla.org/en/docs/Web/API/File) object for newly dropped files (Fix #680)
- [x] Cleans up URLs generated for preview (Fixes #681)
- [x] Tests
@fzaninotto
Copy link
Member

Fixed by #684

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants