Skip to content

Enhancement : Do not cache file downloads with errors #375

@ghugues

Description

@ghugues

If a PFFile download results in an error with a body then this body is cached in the PFFile cache and returned (forever) in subsequent file downloads.
Here is an example erroneous body found in the PFFileCache for what is supposed to be an image :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront is currently experiencing problems with requesting objects from Amazon S3.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: wQTa-tBMCf16IShvTfla3aRfb9ntBBlLL6rfZYrJZRVtWAztTHI60w==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

I suggest checking the HTTP response code and only caching successful downloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions