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

Making into disposition string to lowercase to fix the comparision issue #566

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ambrous
Copy link

@ambrous ambrous commented Dec 11, 2020

Hi!

I faced an issue that in some cases field disposition comes in upper case and due to that comparisions of 'attachment' == $partStructure->disposition faild. It seems that it happens with outlook attachments.

Also, I'm not sure that is was a good idea to add an additional param to function of downloadAttachment, but I suppose it looks a bit more clear.

@Sebbo94BY Sebbo94BY changed the base branch from master to develop February 23, 2021 15:08
@Sebbo94BY
Copy link
Collaborator

@ambrous this change seems to break something. Please rebase and solve this issue. Otherwise I'll close this pull request in the future.

@ambrous
Copy link
Author

ambrous commented Feb 24, 2021

@Sebi94nbg , I've rebased. However, I don't know how to recheck again by codeclimate.

@Sebbo94BY
Copy link
Collaborator

@bapcltd-marv I'm kinda unsure about this change. Does it make sense to you? Would you merge it?

@ambrous
Copy link
Author

ambrous commented Sep 9, 2021

I think it is useful fix as sometime attachments are lost due to the low case of the disposition.

@Sebbo94BY Sebbo94BY changed the base branch from develop to master December 28, 2021 00:33
Copy link
Collaborator

@Sebbo94BY Sebbo94BY left a comment

Choose a reason for hiding this comment

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

Sorry, forgot to publish my review. 😞

@@ -1249,9 +1249,9 @@ public function getMail(int $mailId, bool $markAsSeen = true): IncomingMail
*
* @return IncomingMailAttachment $attachment
*/
public function downloadAttachment(DataPartInfo $dataInfo, array $params, object $partStructure, bool $emlOrigin = false): IncomingMailAttachment
public function downloadAttachment(DataPartInfo $dataInfo, array $params, object $partStructure, bool $emlOrigin = false, bool $dispositionAttachment = false): IncomingMailAttachment
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are adding a new argument here and set it by default to false, but it seems like as it's never used, so it's always false. Isn't it?

Copy link
Author

Choose a reason for hiding this comment

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

No, please see the whole changed function not only my changes.

{
if ('RFC822' == $partStructure->subtype && isset($partStructure->disposition) && 'attachment' == $partStructure->disposition) {
if ('RFC822' == $partStructure->subtype && isset($partStructure->disposition) && $dispositionAttachment) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm still not sure, if this is a good replacement. I think, this will break (also) something.

Before: string comparisation
After: boolean comparisation

Copy link
Author

Choose a reason for hiding this comment

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

This function skipped attachments in some emails due to case sensitive comparison.
I've just put almost the same comparison (but now it is not case sensitive) in one place and then use the boolean replacement of it, kind of some refactoring)

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