Skip to content

Fix: Copied attachments throw not_scanned error when opened - #599

Merged
akgarg06 merged 10 commits into
developfrom
RBSDMS-virus-scan-issue-fix-feature
Sep 25, 2026
Merged

akgarg06 merged 10 commits into
developfrom
RBSDMS-virus-scan-issue-fix-feature

Conversation

@akgarg06

@akgarg06 akgarg06 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes

  • Fixed {"error":{"code":"not_scanned",...}} error thrown when opening attachments from copied sourcing events
  • Root cause: createDraftEntries inserted records via DraftService.newDraft() which routes through CAP's handler chain — @readonly fields (status, scannedAt) get stripped, causing HANA to apply the column default 'Unscanned'
  • Fix: after newDraft(insert), a follow-up persistenceService.run(Update) writes status = 'Clean' and scannedAt = current timestamp directly to the draft table, bypassing @readonly enforcement

Root Cause Detail

createDraftEntries
  └─ matchingService.newDraft(insert)
       └─ CAP handler chain fires
            └─ @readonly fields (status, scannedAt) stripped from INSERT payload
                 └─ HANA applies DEFAULT: status = 'Unscanned', scannedAt = null

User opens copied attachment
  └─ CAP AttachmentStatusValidator checks status != "Clean"
       └─ throws not_scanned error

New uploads are unaffected because addAttachmentToDraft uses persistenceService.run() directly (bypasses CAP handler chain).


Files Changed

File Change
sdm/src/main/java/.../service/handler/SDMCustomServiceHandler.java Add post-UPDATE via persistenceService after newDraft to write status='Clean' and scannedAt=now() directly to the draft table

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist before requesting a review

  • I follow Java Development Guidelines for SAP
  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

Upload Screenshots/lists of the scenarios tested

  • I have Uploaded Screenshots or added lists of the scenarios tested in description

Single Tenant test cases : https://github.com/cap-java/sdm/actions/runs/36109446454
Multi Tenant test cases: https://github.com/cap-java/sdm/actions/runs/36139011245

@akgarg06 akgarg06 changed the title Rbsdms virus scan issue fix feature Fix: Copied attachments throw not_scanned error when opened Sep 24, 2026
@akgarg06
akgarg06 marked this pull request as ready for review September 24, 2026 13:50
This reverts commit 798f220.

This branch was successfully deployed

2 active (1 outdated) deployments
pr-analysis — af92cf11 Deployed Sep 25, 2026 by akgarg06 via build #2081
dev — 2c37ed22 Deployed Sep 25, 2026 by akgarg06 via test-summary #236
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.

3 participants