function getDownloadURLFromUploadTaskSnapshot(uploadTaskSnapshot) {
  // Handle different downloadURL patterns (Firebase JS SDK v5.*.* vs v4.*.*)
  if (
    uploadTaskSnapshot.ref &&
    typeof uploadTaskSnapshot.ref.getDownloadURL === 'function'
  ) {
    // Get downloadURL and attach to response
    return uploadTaskSnapshot.ref.getDownloadURL()
  }
  // Only attach downloadURL if downloadURLs is defined (not defined in v5.*.*)
  return Promise.resolve(
    uploadTaskSnapshot.downloadURLs && uploadTaskSnapshot.downloadURLs[0]
  )
}
Get download URL from upload task snapshot
@param {firebase.storage.UploadTaskSnapshot} uploadTaskSnapshot - Upload task snapshot
@returns {Promise} Resolves with download URL