-
Notifications
You must be signed in to change notification settings - Fork 581
Improve error message for export operations in batch/transaction bundles #5475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,6 +539,14 @@ private async Task GenerateRequest(EntryComponent entry, int order, Cancellation | |
|
|
||
| var requestUrl = entry.Request?.Url; | ||
|
|
||
| // Export operations are not supported within bundles (batch or transaction). | ||
| // Return a clear error instead of the cryptic Accept header error that occurs | ||
| // when the internal routing fails to set required export headers. | ||
| if (requestUrl != null && requestUrl.Contains("$export", StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| throw new RequestNotValidException(Core.Resources.ExportOperationNotSupportedInBundle); | ||
| } | ||
|
||
|
|
||
| // For resources within a transaction, we need to resolve any intra-bundle references and potentially persist any internally assigned ids | ||
| HTTPVerb requestMethod = entry.Request.Method.Value; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
$exportdetection usesrequestUrl.Contains("$export", ...), which will also match query-string values (e.g.,Patient?name=$export) and can falsely reject non-export requests. Consider parsingrequestUrlas aUriand checking only the path segments for a segment equal to$export(after unescaping), rather than searching the full URL string.