Skip to content

Commit

Permalink
Update package.json, changelog, and plugin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SoujitD-SAP committed Oct 24, 2024
1 parent c02e2dd commit c14f396
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ 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
## Version 1.1.8

### Added

- Size validation check for uploaded attachments.

## Version 1.1.8
- Added limit for file size .

### Changed

Expand Down
11 changes: 2 additions & 9 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ cds.once("served", async function registerPluginHandlers() {

if (req?.req?.url?.endsWith("/content")) {
const attachmentID = req.req.url.match(attachmentIDRegex)[1];
const status = await AttachmentsSrv.getStatus(req.target, {
ID: attachmentID,
});
const status = await AttachmentsSrv.getStatus(req.target, {ID: attachmentID,});
const scanEnabled = cds.env.requires?.attachments?.scan ?? true;
if (scanEnabled && status !== "Clean") {
req.reject(
Expand All @@ -86,12 +84,7 @@ cds.once("served", async function registerPluginHandlers() {
}

async function readAttachment([attachment], req) {
if (
!req?.req?.url?.endsWith("/content") ||
!attachment ||
attachment?.content
)
return;
if (!req?.req?.url?.endsWith("/content") ||!attachment ||attachment?.content) return;
let keys = { ID: req.req.url.match(attachmentIDRegex)[1] };
let { target } = req;
attachment.content = await AttachmentsSrv.get(target, keys, req); //Dependency -> sending req object for usage in SDM plugin
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"scripts": {
"lint": "npx eslint .",
"test": "npx jest attachments.test.js"
"test": "npx jest"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.400.0",
Expand Down

0 comments on commit c14f396

Please sign in to comment.