Skip to content

Dowloading a blob should not reject on 304 #80

@arichiardi

Description

@arichiardi

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the SDK was used?

10.3.0

What's the Node.js/Browser version?

v8.12.0

What problem was encountered?

When using BlobURL.download and the If-None-Modified modifiedAccessCondition, I noticed that the promise gets rejected with a response code 304.

It feels a bit unnatural though to have to catch and branch in there in this case:

       (.catch (fn [error]
                     (let [code (gobj/get error "statusCode")]
                       (cond
                         ;; not found
                         (= 404 code) (do (when cache
                                            (vswap! cache cache/evict blob-name))
                                          (reject nil))

                         ;; not modified
                         (= 304 code)
                         (resolve (some-> cache
                                          deref
                                          (cache/lookup blob-name)
                                          :content))

                         :else (reject error)))))

Promise rejections are usually signalling unrecoverable problems and are stopping the code flow. I think that 30X would not be treated as exceptions. Even better, maybe an option should allow you to chose what you want to reject on - some library does that.

Steps to reproduce the issue?

Try to pass a populated blobAccessConditions -> modifiedAccessConditions -> ifNoneMatch options to download any blob.

Have you found a mitigation/solution?

See above, not really satisfying.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions