Skip to content

Fix inbox document uploads#662

Merged
yingbull merged 3 commits intodevelop/dogfishfrom
issue-656-doc-upload
Oct 1, 2025
Merged

Fix inbox document uploads#662
yingbull merged 3 commits intodevelop/dogfishfrom
issue-656-doc-upload

Conversation

@sebastian-j-ibanez
Copy link
Copy Markdown
Collaborator

@sebastian-j-ibanez sebastian-j-ibanez commented Sep 30, 2025

Changes made

  • Use original file name in DocumentUpload2Action (not the "on disk" file name).
  • Add null/empty file name check to IncomingDocUtil.
  • Add viewIncomingDocPageAsPdf, viewIncomingDocPageAsImage, and displayIncomingDocs as actions in ManageDocument2Action.

Summary by Sourcery

Fix inbox document uploads by preserving original file names, improving filename validation, preventing null page actions, and adding new view actions for incoming documents

New Features:

  • Add actions to view incoming document pages as PDF and image and to display incoming documents in ManageDocument2Action

Bug Fixes:

  • Use original uploaded file name instead of on-disk name in DocumentUpload2Action
  • Guard against null or empty pdfAction in IncomingDocUtil.doPagesAction

Enhancements:

  • Reject hidden filenames (starting with ‘.’) and enforce non-empty, .pdf-only base names during sanitization

…cument methods, skip validation on empty action
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Sep 30, 2025

Reviewer's Guide

This PR fixes inbox document uploads by preserving and validating the original uploaded file names, hardening incoming document utilities with null/empty checks, and exposing new actions for viewing and displaying incoming documents.

Class diagram for updated DocumentUpload2Action

classDiagram
class DocumentUpload2Action {
  - File docFile
  - File filedata
  + String filedataFileName
  + String filedataContentType
  - String docPublic
  - String mode
  + String getFiledataFileName()
  + void setFiledataFileName(String filedataFileName)
  + String getFiledataContentType()
  + void setFiledataContentType(String filedataContentType)
}
Loading

Class diagram for updated ManageDocument2Action actions

classDiagram
class ManageDocument2Action {
  + void viewIncomingDocPageAsPdf()
  + void viewIncomingDocPageAsImage()
  + void displayIncomingDocs()
}
Loading

File-Level Changes

Change Details Files
Improved file name handling and validation in DocumentUpload2Action
  • Use this.filedataFileName instead of docFile.getName()
  • Added filedataFileName and filedataContentType fields with getters/setters
  • Enhanced sanitizeFileNameForIncomingDocs to reject hidden files and empty or non-PDF names
DocumentUpload2Action.java
Add null/empty pdfAction guard in IncomingDocUtil
  • Return early in doPagesAction when pdfAction is null or blank
IncomingDocUtil.java
Expose incoming document view/display actions in ManageDocument2Action
  • Register viewIncomingDocPageAsPdf action
  • Register viewIncomingDocPageAsImage action
  • Register displayIncomingDocs action
ManageDocument2Action.java

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sebastian-j-ibanez sebastian-j-ibanez linked an issue Sep 30, 2025 that may be closed by this pull request
2 tasks
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The silent early return in doPagesAction for empty pdfAction can complicate debugging—consider adding logging or explicit error handling when pdfAction is missing.
  • Filename sanitization logic is duplicated in multiple places; centralize the validation/sanitization into a shared utility to ensure consistency and reduce code duplication.
  • The new filedataContentType field is never used—either remove it or leverage it to validate uploaded file types and improve upload security.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The silent early return in doPagesAction for empty pdfAction can complicate debugging—consider adding logging or explicit error handling when pdfAction is missing.
- Filename sanitization logic is duplicated in multiple places; centralize the validation/sanitization into a shared utility to ensure consistency and reduce code duplication.
- The new filedataContentType field is never used—either remove it or leverage it to validate uploaded file types and improve upload security.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 30, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 5e66a3a.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@yingbull yingbull self-requested a review October 1, 2025 15:08
@yingbull yingbull merged commit 126ac89 into develop/dogfish Oct 1, 2025
11 of 15 checks passed
@yingbull yingbull deleted the issue-656-doc-upload branch October 1, 2025 15:50
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.

[Bug]: Uploading Multiple Documents resulting in unknown files

2 participants