Skip to content
Advertisement

Firestorage has different behavior when hardcode

I don’t know what happened with my code. But everytime i used this code is working

JavaScript

But when i switched to urlPathThumbs it will become error 404. Error said like so

Firebase Storage: Object ‘courses/m9APF8TEUnfS6IQew591sl4kphH2/thumbs/Rectangle 68 (1)_200x200.png’ does not exist. (storage/object-not-found)

however they both are same pattern. This is how variable urlPathThumbs created in previous snippet code

JavaScript

this file is successful uploaded and i can see it in firebase storage location: firebase storage

Please can somebody help me?

Advertisement

Answer

since refFromURL is expecting a URL string, spaces should not be allow. You will need to urlencode the spaces.

e.g.

JavaScript

refFromURL refFromURL ( url : string ) : Reference Returns a reference for the given absolute URL.

Parameters url: string A URL in the form: 1) a gs:// URL, for example gs://bucket/files/image.png 2) a download URL taken from object metadata. @see firebase.storage.FullMetadata.downloadURLs

Advertisement