Repository navigation
Firebase in .NET: handle shoes stored without an image link - #2459
Merged
Merged
Conversation
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shoes created in the Firestore part of the article are stored without an image link, so their
ShoeDocument.ImageUriis an empty string.new Uri(string.Empty)throwsUriFormatException, and the Firestore index page returned a 500 as soon as one such shoe was in the collection.Shoe.ImageUriis nowUri?.ConvertDocumentToModelmaps an empty link tonull, andConvertModelToDocumentstores an empty string when a shoe has no link. The Index page needs no change, because Razor leaves out thesrcattribute 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
mainand no new ones, and all 5 tests pass locally.