Skip to content

Commit

Permalink
Fixed serialization for relative URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
lbnascimento committed Jul 13, 2021
1 parent 5ec64e5 commit 2db51be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion LiteDB/Client/Mapper/BsonMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public BsonMapper(Func<Type, object> customTypeInstantiator = null, ITypeNameBin

#region Register CustomTypes

RegisterType<Uri>(uri => uri.AbsoluteUri, bson => new Uri(bson.AsString));
RegisterType<Uri>(uri => uri.IsAbsoluteUri ? uri.AbsoluteUri : uri.ToString(), bson => new Uri(bson.AsString));
RegisterType<DateTimeOffset>(value => new BsonValue(value.UtcDateTime), bson => bson.AsDateTime.ToUniversalTime());
RegisterType<TimeSpan>(value => new BsonValue(value.Ticks), bson => new TimeSpan(bson.AsInt64));
RegisterType<Regex>(
Expand Down

1 comment on commit 2db51be

@lbnascimento
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for #2021

Please sign in to comment.