-
Notifications
You must be signed in to change notification settings - Fork 19
Single Attachment Bug Fixes #472
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 all commits
473cc86
1bc938e
d17caad
5e82a56
c0f2dc1
248944d
5c10295
197e315
472fbcf
6e33ebd
e991688
974ca86
4548cc1
9ef16d8
106c2a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,10 @@ const { | |
| require("./csn-runtime-extension") | ||
| const LOG = cds.log("attachments") | ||
|
|
||
| cds.on(cds.version >= "8.6.0" ? "compile.to.edmx" : "loaded", unfoldModel) | ||
| cds.on( | ||
| cds.version.split(".")[0] >= 8 ? "compile.to.edmx" : "loaded", | ||
| unfoldModel, | ||
| ) | ||
|
|
||
| // Register the db handler ONCE (not per-service) to intercept attachment INSERT | ||
| // and handle it through the attachments service instead of native DB insert | ||
|
|
@@ -247,7 +250,11 @@ cds.once("served", () => { | |
| */ | ||
| function unfoldModel(csn) { | ||
| const meta = (csn.meta ??= {}) | ||
| if (!("sap.attachments.Attachments" in csn.definitions)) return | ||
| if ( | ||
| !("sap.attachments.Attachments" in csn.definitions) && | ||
| !("sap.attachments.Attachment" in csn.definitions) | ||
| ) | ||
| return | ||
| if (meta._enhanced_for_attachments) return | ||
| // const csnCopy = structuredClone(csn) // REVISIT: Why did we add this cloning? | ||
| const hasFacetForComp = (name, facets) => | ||
|
|
@@ -598,11 +605,10 @@ cds.ApplicationService.handle_attachments = cds.service.impl(async function () { | |
|
|
||
| if (!prefix) return next() | ||
|
|
||
| await onPrepareAttachment(req) | ||
| if (!validateAttachmentMimeType(req)) return | ||
|
Comment on lines
+608
to
609
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic Error: For stream PUT requests (when The original ordering called Please provide feedback on the review comment by checking the appropriate box:
|
||
| if (!(await validateAttachmentSize(req))) return | ||
|
eric-pSAP marked this conversation as resolved.
|
||
|
|
||
| await onPrepareAttachment(req) | ||
|
|
||
| if (getAttachmentKind() !== "db") { | ||
| await putInlineAttachmentObjectStore(req, prefix) | ||
| } else { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.