Skip to content

Commit ab1e180

Browse files
author
Bart Koelman
authored
Hotfix (#722)
* Fixed: stackTrace:null in output when options.IncludeExceptionStackTraceInErrors = false * Fixed: crash when using obfuscated IDs
1 parent 237dbba commit ab1e180

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/JsonApiDotNetCore/Models/JsonApiDocuments/ErrorMeta.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ public sealed class ErrorMeta
1515

1616
public void IncludeExceptionStackTrace(Exception exception)
1717
{
18-
Data["StackTrace"] = exception?.Demystify().ToString()
19-
.Split(new[] {"\n"}, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
18+
if (exception == null)
19+
{
20+
Data.Remove("StackTrace");
21+
}
22+
else
23+
{
24+
Data["StackTrace"] = exception.Demystify().ToString()
25+
.Split(new[] { "\n" }, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
26+
}
2027
}
2128
}
2229
}

src/JsonApiDotNetCore/Services/DefaultResourceService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public virtual async Task<TResource> UpdateAsync(TId id, TResource requestEntity
213213
}
214214

215215
_repository.FlushFromCache(databaseEntity);
216-
TResource afterEntity = await _repository.Get(databaseEntity.Id).FirstOrDefaultAsync();
216+
TResource afterEntity = await _repository.Get(id).FirstOrDefaultAsync();
217217
_resourceChangeTracker.SetFinallyStoredAttributeValues(afterEntity);
218218

219219
bool hasImplicitChanges = _resourceChangeTracker.HasImplicitChanges();

0 commit comments

Comments
 (0)