Aman kumar
Aman kumar

Reputation: 1

Issues handling Image Url for blob files on Firebase

I am having issues on handling blob files as imageurl in the notification payload for firebase. The file that got uploaded on azure storage had spaces and special characters which got saved as below

"Admin/Comm/notification/Screenshot 2024-07-17 152201_638697068094142827.png"

Below is the FullUrl I got after generating sas url

"https://mpartnercontant.blob.core.windows.net/mpartner-dev-cms/Admin/Comm/notification/Screenshot 2024-07-17 152201_638697068094142827.png?sv=2024-11-04&se=2024-12-14T11%3A56%3A41Z&sr=b&sp=r&sig=somevalueFww%2FnXR7pVUhFW3W%2B8D2UW3ln96a8%3D&response-content-disposition=inline" 

And this is after uri encoding


"https://mpartnercontant.blob.core.windows.net/mpartner-dev-cms/Admin/Comm/notification/Screenshot%202024-07-17%20152201_638697068094142827.png?sv=2024-11-04&se=2024-12-14T11%253A56%253A41Z&sr=b&sp=r&sig=somevalueFww%252FnXR7pVUhFW3W%252B8D2UW3ln96a8%253D&response-content-disposition=inline"

Issue is the FullUrl is giving an error malformed url when i pass it in the imageurl property of the notification object as below but after uri encoding its giving an issue file doesn't exists. Not sure on how we can handle blobs with spaces as urls in the firebase notification objects

            Android = new AndroidConfig
            {
                Notification = new AndroidNotification
                {
                    ImageUrl = string.IsNullOrEmpty(fullAttachmentUrl) ? null : Uri.EscapeUriString(fullAttachmentUrl)
                }
            },
            Apns = new ApnsConfig
            {
                Aps = new Aps
                {
                    MutableContent = true
                },
                FcmOptions = new ApnsFcmOptions
                {
                    ImageUrl = string.IsNullOrEmpty(fullAttachmentUrl) ? null : Uri.EscapeUriString(fullAttachmentUrl)
                }
            },

I tried encoding the url but it didn't work as a blob with encoded name won't exist in azure storage.

Upvotes: 0

Views: 21

Answers (0)

Related Questions