As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
passing undefined as id to file stream, runs the success callback with array of all images objects
N
NouranMahmoud
started a topic
over 8 years ago
Hi, I am trying to use the `Kinvey.File.stream` and I pass a backbonejs attribute which contains the image_id and sometimes be `undefined`. The returned result `response` in success callback is an array containing all the image objects stored in google store.
here's my code:
category_icon_id = @get "category_icon_file" #when undefined
promise1 = Kinvey.File.stream( category_icon_id,
success: (file) ->
#file is an array of all image objects retrieved from .
options.primaryImg.onSuccess
error: (error) ->
options.primaryImg.onError error
)
This makes a heavy load which I don't need.
1 Comment
Damien Bell
said
over 8 years ago
Good morning NouranMahmoud,
The reason why you are seeing all the items in your google cloud storage returned is because undefined will not filter the incoming query.
You are probably trying to do something similar to:
function loadImage(category_icon_id) {
if (category_icon_id === undefined) {
category_icon_id = this.get("category_icon_file");
}
...
}
The function above will ensure that you are not passing undefined values in to your GCS call.
Thanks,
NouranMahmoud