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

(fix) O3-3627: Preserve original filename when saving an attachment #1183

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

suubi-joshua
Copy link
Contributor

@suubi-joshua suubi-joshua commented Oct 20, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

This PR amends the logic that uploads a file to the server, ensuring that when a File object is provided, the original filename is saved. Presently, if the user manually edits the filename, the existing logic will save the original filename from the File object (typically the user's selection from the file dialog). This change makes it so that the filename is saved as the user edits it, rather than the original filename.

Screenshots

Related Issue

Other

@suubi-joshua
Copy link
Contributor Author

suubi-joshua commented Oct 21, 2024

@denniskigen Still trying to figure out how to hide the type extension from the user.
Before
Screencast from 21-10-24 15:23:04.webm

After
Screencast from 21-10-24 03:04:12.webm

@denniskigen
Copy link
Member

denniskigen commented Oct 22, 2024

Thanks, @suubi-joshua!

@@ -23,7 +23,7 @@ export async function createAttachment(patientUuid: string, fileToUpload: Upload
formData.append('patient', patientUuid);

if (fileToUpload.file) {
formData.append('file', fileToUpload.file);
formData.append('file', fileToUpload.file, fileToUpload.fileName);
Copy link
Member

@denniskigen denniskigen Oct 22, 2024

Choose a reason for hiding this comment

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

I've tested this out and found that it works as expected, i.e. the provided filename is preserved after saving the file @dkayiwa, @ibacher. Any qualms with the approach?

@denniskigen denniskigen changed the title (FIX) O3-3627-- Enable Attachment Name and Descriptio to Display on the Saved Attachment (fix) O3-3627: Preserve original filename when saving an attachment Oct 22, 2024
@denniskigen denniskigen merged commit e640bba into openmrs:main Oct 22, 2024
14 checks passed
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