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: handle the case where asset name can be missing [WPB-10830] 🍒 🍒 #3012

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 13, 2024

BugWPB-10830 [Android] Receiving images is prohibited when shared from iOS from col3 backend

This PR was automatically cherry-picked based on the following PR:

Original PR description:


This PR was automatically cherry-picked based on the following PR:

Original PR description:



PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

  1. iOS does not send asset name when sending images
  2. web sends 2 messages the first one with meta data including name and mimeType, and a second with where to get the asset from

Causes (Optional)

in both cases if asset restriction is on then the message will not be handled correctly and in iOS case it will show prohibated asset, and in web case it will not be visable

Solutions

  1. add fail safe to check mimeType when name is missing, did not cover all cases but the most common mimeType, this should be enugh tho
  2. allow handling of assets with data and no name since it will be handled later in the code by getting the type of the first message

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

…3002)

* Commit with unresolved merge conflicts

* merge conflicts

---------

Co-authored-by: Mohamad Jaara <[email protected]>
@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch echoes: bugs Technical or functional defects in the product type: bug / fix 🐞 👕 size: L 🚨 Potential breaking changes labels Sep 13, 2024
…t-received-in-proteus-conversation-cherry-pick-cherry-pick
Copy link

sonarcloud bot commented Sep 16, 2024

Copy link
Contributor Author

github-actions bot commented Sep 16, 2024

Test Results

3 204 tests  +4   3 099 ✔️ +4   3m 32s ⏱️ -17s
   551 suites ±0      105 💤 ±0 
   551 files   ±0          0 ±0 

Results for commit 3663189. ± Comparison against base commit 85e5c25.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
com.wire.kalium.logic.feature.asset.ValidateAssetFileTypeUseCaseTest ‑ givenRegularFileNameWithFewExtensions_whenInvoke_thenEachExtensionIsChecked[jvm]
com.wire.kalium.logic.feature.asset.ValidateAssetFileTypeUseCaseTest ‑ givenFileNameIs[jvm]
com.wire.kalium.logic.feature.asset.ValidateAssetFileTypeUseCaseTest ‑ givenNullFileNameAndInvalidMimeType_whenInvoke_thenMimeTypeIsChecked[jvm]
com.wire.kalium.logic.feature.asset.ValidateAssetFileTypeUseCaseTest ‑ givenNullFileNameAndValidMimeType_whenInvoke_thenMimeTypeIsChecked[jvm]
com.wire.kalium.logic.sync.receiver.asset.AssetMessageHandlerTest ‑ givenFileWithNullNameAndCompleteData_whenProcessingCheckAPreviousAssetWithTheSameIDIsMissing_thenStoreAsRestricted[jvm]
com.wire.kalium.logic.sync.receiver.asset.AssetMessageHandlerTest ‑ givenFileWithNullNameAndCompleteData_whenProcessingCheckAPreviousAssetWithTheSameIDIsRestricted_thenDoNotStore[jvm]

♻️ This comment has been updated with latest results.

@MohamadJaara MohamadJaara added this pull request to the merge queue Sep 16, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 85.98131% with 15 lines in your changes missing coverage. Please review.

Project coverage is 52.54%. Comparing base (85e5c25) to head (3663189).

Files with missing lines Patch % Lines
...m/logic/sync/receiver/asset/AssetMessageHandler.kt 69.04% 7 Missing and 6 partials ⚠️
...com/wire/kalium/logic/data/message/AssetContent.kt 0.00% 1 Missing ⚠️
...ic/feature/asset/ScheduleNewAssetMessageUseCase.kt 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3012      +/-   ##
===========================================
+ Coverage    52.49%   52.54%   +0.05%     
===========================================
  Files         1301     1301              
  Lines        49977    50059      +82     
  Branches      4652     4666      +14     
===========================================
+ Hits         26233    26304      +71     
- Misses       21872    21879       +7     
- Partials      1872     1876       +4     
Files with missing lines Coverage Δ
...ogic/feature/asset/ValidateAssetFileTypeUseCase.kt 100.00% <100.00%> (ø)
...com/wire/kalium/logic/data/message/AssetContent.kt 0.00% <0.00%> (ø)
...ic/feature/asset/ScheduleNewAssetMessageUseCase.kt 88.77% <75.00%> (+0.18%) ⬆️
...m/logic/sync/receiver/asset/AssetMessageHandler.kt 78.08% <69.04%> (-11.28%) ⬇️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85e5c25...3663189. Read the comment docs.

@datadog-wireapp
Copy link

Datadog Report

Branch report: fix/Images-and-files-from-same-backend-not-received-in-proteus-conversation-cherry-pick-cherry-pick
Commit report: 34c26ec
Test service: kalium-jvm

✅ 0 Failed, 3099 Passed, 105 Skipped, 12.34s Total Time

Merged via the queue into develop with commit 582e546 Sep 16, 2024
21 of 22 checks passed
@MohamadJaara MohamadJaara deleted the fix/Images-and-files-from-same-backend-not-received-in-proteus-conversation-cherry-pick-cherry-pick branch September 16, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch echoes: bugs Technical or functional defects in the product 🚨 Potential breaking changes 👕 size: L type: bug / fix 🐞
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants