cloudinary / cloudinary/cloudinary_ios

404 responses are still written to the cache

Open
#278 2 comments 0 reactions 2 assignees Claimed by @michalkcloudinay View on GitHub
bug
Dominant language
Swift
Stars
169
Forks
107
PR merge metrics
No merged PRs in 30d

Description

## Bug report for Cloudinary iOS SDK
Before proceeding, please update to latest version and test if the issue persists

## Describe the bug in a sentence or two.
When the cloudinary URL request fails with a 404, the `downloadImageAndCacheIt` function still attempts to write a 0 byte file to the cache.

## Issue Type (Can be multiple)
[ ] Build - Can’t install or import the SDK
[ ] Performance - Performance issues
[x] Behaviour - Functions aren’t working as expected (Such as generate URL)
[ ] Documentation - Inconsistency between the docs and behaviour
[ ] Other (Specify)

## Steps to reproduce
Simply call `CLDDownloader.fetchImage(_:_:completionHandler:)` with an invalid URL.

## Error screenshots or Stack Trace (if applicable)
The following error is raised:
```
{
"error_code" = "-7001";
"error_domain" = "com.cloudinary.error";
"user_info" = {
NSLocalizedFailureReason = "Failed creating an image from the received data.";
};
```
There was no received data.
![image](https://user-images.githubusercontent.com/36736031/98703632-9dc3d400-2373-11eb-8932-5577b256e083.png)

## Build/Dependency management
[x] Cocoa-Pods
[ ] Carthage
[ ] Manual import
[ ] Other (Specify)

## Is the issue reproducible only on a specific device?
[x] No
[ ] Yes (specify model + iOS version)

## Versions and Libraries (fill in the version numbers)
iOS Cloudinary SDK version - 2.9.0
OSX (on the dev environment) - 10.15.6 (19G73)
XCode - 12.1 (12A7403)
Swift - 5
Target iOS - 14.1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.