-
Notifications
You must be signed in to change notification settings - Fork 4
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
Limiting file size #105
base: main
Are you sure you want to change the base?
Limiting file size #105
Conversation
rectified the test file size
CHANGELOG.md
Outdated
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. | |||
This project adheres to [Semantic Versioning](http://semver.org/). | |||
The format is based on [Keep a Changelog](http://keepachangelog.com/). | |||
|
|||
## Version 1.1.9 |
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.
Changelog has to be added in 1.1.8 version itself
CHANGELOG.md
Outdated
|
||
### Added | ||
|
||
- Size validation check for uploaded attachments. |
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.
Added limit for file size ....
lib/plugin.js
Outdated
const scanEnabled = cds.env.requires?.attachments?.scan ?? true | ||
if(scanEnabled && status !== 'Clean') { | ||
req.reject(403, 'Unable to download the attachment as scan status is not clean.'); | ||
const status = await AttachmentsSrv.getStatus(req.target, { |
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.
you can remove the code formatting
lib/plugin.js
Outdated
} | ||
} | ||
} | ||
|
||
async function readAttachment([attachment], req) { | ||
if (!req?.req?.url?.endsWith("/content") || !attachment || attachment?.content) return; | ||
let keys = { ID : req.req.url.match(attachmentIDRegex)[1]}; | ||
if ( |
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.
here also
You can edit the script in package.json - |
Changes in CHANGELOG.md with mention of UI5 version compatibilty. Tested in local and hybrid mode. |
lib/plugin.js
Outdated
@@ -6,7 +6,7 @@ const attachmentIDRegex = /\/\w+\(.*ID=([0-9a-fA-F-]{36})/; | |||
|
|||
cds.on("loaded", function unfoldModel(csn) { | |||
if (!("Attachments" in csn.definitions)) return; | |||
const csnCopy = structuredClone(csn) | |||
const csnCopy = structuredClone(csn); |
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.
Can you remove all the formatting changes in this file, as these lines are out of scope for this specific task.
Formatted by tallying from main branch |
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.
Handling PUT request with 'before' handler to fetch the content length of the uploaded attachment in plugin.js.
Impose validation checks for size limit and rejecting the request which are above size limit.
Currently cannot access the UI part but validation checks are both imposed for hybrid and local mode.