Skip to content
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

Making the inital commit #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Making the inital commit #105

wants to merge 2 commits into from

Conversation

SoujitD-SAP
Copy link
Contributor

Limit the upload size of an attachment in the attachment plugin. Currently the maximum size size of data that can be scanned by the Malware Scanning Service on BTP is 400MB. So we would limit the file upload size to 400 MB.

  1. Handling PUT request with 'before' handler to fetch the content length of the uploaded attachment in plugin.js.

  2. Impose validation checks for size limit and rejecting the request which are above size limit.

  3. Currently cannot access the UI part but validation checks are both imposed for hybrid and local mode.

lib/plugin.js Outdated
@@ -56,8 +57,36 @@ cds.once("served", async function registerPluginHandlers() {
}
}

function computeAttachment(req) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename the function, something like checkAttachmentLength?

lib/plugin.js Outdated
@@ -41,6 +41,7 @@ cds.once("served", async function registerPluginHandlers() {
srv.before("READ", [target, target.drafts], validateAttachment);

srv.after("READ", [target, target.drafts], readAttachment);
srv.before("PUT", [target, target.drafts], computeAttachment);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to do this in target too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants