danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

When blobUrl is removed from blobUrls cache and url is revoked re-referencing url results in 404 error #2013

Open dapowell opened 6 years ago

dapowell commented 6 years ago

We are using data-ngf-src for upload preview inside of a ui-grid with virtualization.

If you upload a lot of assets and scroll down to load each preview, then scroll back up to the top. The initially loaded previews fail to display and 404 errors are output to the console.

I suspect this would also occur with uploading a lot of assets and previewing them in a paged view as well and then return to the first page.

It seems that when blobUrlsTotalSize reaches maxMemory or blobUrls reaches maxLength, the initial url(s) are removed from the blobUrls cache and the url is revoked, but $ngfBlobUrl remains on the file with the removed url. This needs to be cleared on the file associated with the url being removed when the url is revoked so it can be regenerated if the asset is reloaded.