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

issue: Canned Response Inline Images #6623

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

JediKev
Copy link
Contributor

@JediKev JediKev commented Oct 25, 2023

This addresses an issue where saving edits made to a canned response with two or more inline images either breaks the page or causes 500 error. This is due to incorrectly formatted array of IDs for the inline images causing further issues with $att->file->getId() on render.

This adds a check in keepOnlyFileIds() to see if the $value from the array of IDs is an array itself. If so, we will break apart the $value array into $id (File ID) => $value (File Name) to match the expected format. If the $value is not an array, it will use the existing format (as before). This is important as we have two different array formats for the File IDs depending on what method is called to generate them. We need to be able to account for both formats. In addition, this adds the file name to the $attachment array in getAttachmentIds() so we can save the new attachment name (if different).

Lastly, this fixes an issue where the Canned Response attachment upload field was blindly including all attachments rather than excluding the inline images.

This addresses an issue where saving edits made to a canned response with two
or more inline images either breaks the page or causes 500 error. This is due
to incorrectly formatted array of IDs for the inline images causing further
issues with `$att->file->getId()` on render.

This adds a check in `keepOnlyFileIds()` to see if the `$value` from the array
of IDs is an array itself. If so, we will break apart the `$value` array into
`$id` (File ID) => `$value` (File Name) to match the expected format. If the
`$value` is not an array, it will use the existing format (as before). This is
important as we have two different array formats for the File IDs depending on
what method is called to generate them. We need to be able to account for both
formats. In addition, this adds the file name to the `$attachment` array in
`getAttachmentIds()` so we can save the new attachment name (if different).

Lastly, this fixes an issue where the Canned Response attachment upload field
was blindly including all attachments rather than excluding the inline images.
@JediKev JediKev merged commit d4e1c22 into osTicket:1.17.x Oct 25, 2023
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.

1 participant