Skip to content

Firebase in .NET: handle shoes stored without an image link - #2459

Merged
vladimir-pecanac-main merged 2 commits into
mainfrom
firebase-empty-image-uri
Dec 4, 2026
Merged

vladimir-pecanac-main merged 2 commits into
mainfrom
firebase-empty-image-uri

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Shoes created in the Firestore part of the article are stored without an image link, so their ShoeDocument.ImageUri is an empty string. new Uri(string.Empty) throws UriFormatException, and the Firestore index page returned a 500 as soon as one such shoe was in the collection.

Shoe.ImageUri is now Uri?. ConvertDocumentToModel maps an empty link to null, and ConvertModelToDocument stores an empty string when a shoe has no link. The Index page needs no change, because Razor leaves out the src attribute when the value is null. The code matches code blocks 15 and 16 in the article: https://code-maze.com/dotnet-firebase/

The folder builds with the same 7 warnings as main and no new ones, and all 5 tests pass locally.

CodeMazeBlog and others added 2 commits December 4, 2026 18:27
Shoes created before the image upload step are stored with an empty
ImageUri, and new Uri(string.Empty) threw UriFormatException, so the
Firestore index page failed with a 500. Shoe.ImageUri is now Uri?,
an empty stored link maps to null, and a shoe with no link is stored
with an empty string. Matches the current code in
https://code-maze.com/dotnet-firebase/
@vladimir-pecanac-main
vladimir-pecanac-main merged commit 679f4df into main Dec 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants