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

404 missing file while downloading file product custom option expired by Quote Lifetime & Enable Clear Shopping Cart #39529

Open
3 of 5 tasks
tuyennn opened this issue Jan 10, 2025 · 7 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.

Comments

@tuyennn
Copy link
Member

tuyennn commented Jan 10, 2025

Preconditions and environment

  • Magento version: All version

Steps to reproduce

  1. From Admin create a product and Customizable Options with Option type: File
  2. From frontend purchase this product with an attached file: sample.jpg
  3. Placing order with this.
  4. After expired the period of Quote Lifetime & Enable Clear Shopping Cart: Yes from (Stores > Configuration > Sales > Checkout > Shopping Cart)
  5. Open order detail: from customer side, or admin side to download sample.jpg from order above.

Expected result

  • Attached file sample.jpg could be downloaded

Actual result

  • 404 while attempting to download attached file sample.jpg from order item option

Additional information

Download controller requested to quote_item_option table where the quote of current order was no longer exist by Quote Lifetime & Enable Clear Shopping Cart leading the request to 404.

here is a constraint key relationship between the following tables: quote => quote_item => quote_item_option, tables.

For faster reproduction, you can manually delete the quote instead of waiting for the Quote Lifetime to expire.

Suggestion

  • Modify the download functionality to fetch the file from the sales_order_item table.
  • Alternatively, introduce a new table, sales_order_item_option, to store attached file references that are independent of the quote expiration and cleaning process.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Jan 10, 2025

Hi @tuyennn. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@tuyennn
Copy link
Member Author

tuyennn commented Jan 10, 2025

Related issues #20277 #6558

@engcom-Bravo engcom-Bravo self-assigned this Jan 10, 2025
Copy link

m2-assistant bot commented Jan 10, 2025

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Jan 10, 2025
@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Jan 10, 2025
@engcom-Bravo
Copy link
Contributor

Hi @tuyennn,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is not reproducible.Kindly refer the attached video.

Screen.Recording.2025-01-13.at.10.42.42.am.mov

We are able to download the image successfully.

Kindly recheck the issue in Latest 2.4-develop instance and elaborate the steps to reproduce if the issue is still reproducible.

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Jan 13, 2025
@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jan 13, 2025
@tuyennn
Copy link
Member Author

tuyennn commented Jan 13, 2025

@engcom-Bravo Can you confirm at the time you download the file, the quote of order #000000004 was deleted before?

CustomOption-2025-01-13_16.39.59.mp4

Here what I found, the 404 page occurred after the quote was deleted before you download the file

@engcom-Bravo
Copy link
Contributor

Hi @tuyennn,

Thanks for your update.

We have verified the issue in Latest 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.

Image
Screen.Recording.2025-01-13.at.10.42.42.am.mov

The quote for order has been deleted and We are able to download the image successfully.

Kindly recheck the issue in Latest 2.4-develop instance and elaborate the steps to reproduce if the issue is still reproducible.

Thanks.

@tuyennn
Copy link
Member Author

tuyennn commented Jan 17, 2025

@engcom-Bravo, I re-verified this issue on the 2.4-develop branch and believe it is still a problem.

Reference:
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php#L74-L84

When a quote is deleted, the associated items in the quote_item_option table should also be deleted due to the foreign key constraint.

Here are some screenshots for reference:
Image 1
Image 2

Additionally, consider how the $option object is handled in the code:

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Controller/Download/DownloadCustomOption.php#L74-L84

/** @var $option \Magento\Quote\Model\Quote\Item\Option */
$option = $this->_objectManager->create(
    \Magento\Quote\Model\Quote\Item\Option::class
)->load($quoteItemOptionId);

If the $option no longer exists, the following condition will be met:

if (!$option->getId()) {
    return $resultForward->forward('noroute');
}

As a result, a 404 error occurs.

Can you please provide a recording or confirm the steps you follow to delete the quote? Additionally, verify if the associated quote_item_option records are also deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

2 participants