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

MOSIP-32782 - Password-protected file is not allowed for upload #718

Merged
merged 5 commits into from
Sep 13, 2024

Conversation

GOKULRAJ136
Copy link
Contributor

No description provided.

Copy link
Contributor

@mayuradesh mayuradesh left a comment

Choose a reason for hiding this comment

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

  1. Remove handling for non PDF types
  2. Move document.close() to finally block

@GOKULRAJ136
Copy link
Contributor Author

  1. Remove handling for non PDF types
  2. Move document.close() to finally block

Removed the handling of non-PDF files and included document.close() in the finally block.

Copy link
Contributor

@mayuradesh mayuradesh left a comment

Choose a reason for hiding this comment

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

  1. Internal server error is not allowed, it should be proper specific Error Code only
  2. Try Catch and Finally needs cleanup
  3. No use of document.isEncrypted
  4. Check when to send true in all cases in the validation method

@GOKULRAJ136
Copy link
Contributor Author

  1. Internal server error is not allowed, it should be proper specific Error Code only
  2. Try Catch and Finally needs cleanup
  3. No use of document.isEncrypted
  4. Check when to send true in all cases in the validation method
  • Resolved an internal server error caused by the DocumentException we were using. By switching to a different exception, which is utilized in other methods, now successfully retrieved the accurate error code and message on the server side.
  • Removed the unused document.isEncrypted() method and cleaned up the try-catch blocks.
  • Returning 'true' in the event of an IOException could lead to the mistaken belief that the file is password-protected, when in fact, an error may be hindering the password verification, potentially causing false positives, so better to return a false in this case.

Copy link
Contributor

@mayuradesh mayuradesh left a comment

Choose a reason for hiding this comment

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

Instead of returning false on catching IOException, throw the IOException in isPasswordProtectedFile()

Signed-off-by: GOKULRAJ136 <[email protected]>
@GOKULRAJ136
Copy link
Contributor Author

Instead of returning false on catching IOException, throw the IOException in isPasswordProtectedFile()

Threw an IOException instead of catching it.

@mayuradesh mayuradesh merged commit f6064b6 into mosip:develop Sep 13, 2024
14 checks passed
GOKULRAJ136 added a commit to GOKULRAJ136/pre-registration that referenced this pull request Sep 25, 2024
…p#718)

* MOSIP-32782 - Password-protected file is not allowed for upload

Signed-off-by: GOKULRAJ136 <[email protected]>

* removed non-pdf files types handling

Signed-off-by: GOKULRAJ136 <[email protected]>

* error handling for password protection files

Signed-off-by: GOKULRAJ136 <[email protected]>

* throwing an IOException

Signed-off-by: GOKULRAJ136 <[email protected]>

---------

Signed-off-by: GOKULRAJ136 <[email protected]>
mayuradesh pushed a commit that referenced this pull request Sep 30, 2024
* MOSIP-33036 - Added upgrade and rollback scripts for release-1.3.x

Signed-off-by: GOKULRAJ136 <[email protected]>

* fixed apitest-prereg failures

Signed-off-by: GOKULRAJ136 <[email protected]>

* MOSIP-32782 - Password-protected file is not allowed for upload (#718)

* MOSIP-32782 - Password-protected file is not allowed for upload

Signed-off-by: GOKULRAJ136 <[email protected]>

* removed non-pdf files types handling

Signed-off-by: GOKULRAJ136 <[email protected]>

* error handling for password protection files

Signed-off-by: GOKULRAJ136 <[email protected]>

* throwing an IOException

Signed-off-by: GOKULRAJ136 <[email protected]>

---------

Signed-off-by: GOKULRAJ136 <[email protected]>

---------

Signed-off-by: GOKULRAJ136 <[email protected]>
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