magento-engcom / import-export-improvements

Open Software License 3.0
31 stars 29 forks source link

Unable to import external jpeg images from a CDN with dynamic URLs. #77

Closed piotrekkaminski closed 5 years ago

piotrekkaminski commented 6 years ago

From @dromoded on December 4, 2017 6:27

Unable to import products with external jpeg images hosted on a CDN with dynamic URLs not ending with ".jpg" or ".jpeg", e.g. http://asset.lemansnet.com/media/edge/8/4/0/840EC331-41BE-4AFF-9392-4A35F2C486A9.png?x=260&y=260&b=ffffff&t=image/jpeg (This is a real image, and it is indeed a jpeg. Parameters "x" and "y" control image size, "b" - background color)

The same procedure as described below succeeds for a "plain" image URL (verified for http://cdn.cnn.com/cnnnext/dam/assets/160405140459-06-nba-finals-superlatives-tease-only-large-tease.jpg )

Preconditions

  1. Magento 2.2.1 CE, Composer install
  2. CentOS-7, PHP-7.0.25, NGINX-1.12 + PHP-FPM, Percona-5.7.19
  3. "2-users" setup as described in the installation manual (usermod -a -G nginx maguser, FPM owned by nginx, sgid on directories)

Steps to reproduce

  1. Create the following CSV import file:

    sku,product_type,attribute_set_code,name,price,base_image
    12345,simple,Default,Test,10,http://asset.lemansnet.com/media/edge/8/4/0/840EC331-41BE-4AFF-9392-4A35F2C486A9.png?x=260&y=260&b=ffffff&t=image/jpeg
  2. Magento > Admin > System > Import: Entity Type: Products Import Behavior: Add/Update Stop on Error Allowed Errors Count: 10 Field Separator: , Multiple Value Separator: , Field Enclosure: checked Select File to Import: the file created in step 1 Images File Directory: (left empty)

  3. Click "Check Data" Click "Import"

Expected result

  1. Product "Test", should be created with the base image, as specified in the import file.
  2. The product should appear in the Admin>Catalog>Products list with the specified base image.
  3. The image should be downloaded and saved in ~/pub/media/catalog/product/h/t

Actual result

  1. "Check Data" returns 'File is valid! To start import process press "Import" button' Import returns the following error: "Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1"
  2. Product "Test" is created and appears in Admin>Catalog>Products as specified minus image.
  3. The image is downloaded and saved in ~/pub/media/import with the file name httpasset.lemansnet.commediaedge840840EC331-41BE-4AFF-9392-4A35F2C486A9.pngx260y260bfffffftimagejpeg (verified that it is indeed the right jpeg image file)

Copied from original issue: magento/magento2#12533

piotrekkaminski commented 6 years ago

From @magento-engcom-team on December 4, 2017 12:39

@dromoded, thank you for your report. We've created internal ticket(s) MAGETWO-84958 to track progress on the issue.

piotrekkaminski commented 6 years ago

From @EliasZ on December 6, 2017 8:56

This is related to: #12455

Not exactly the same, but similar problem case. In this case GET params are present in the URL and due to regex stripping characters, the GET params are appended to the file extension resulting in breaking the validation rules.

piotrekkaminski commented 6 years ago

From @PieterCappelle on December 22, 2017 19:24

@okorshenko Can you assign this to me?

piotrekkaminski commented 6 years ago

From @PieterCappelle on December 24, 2017 12:33

Should be fixed. If accepted I'll create backport to 2.2 & 2.1.

piotrekkaminski commented 6 years ago

From @magento-team on January 3, 2018 11:45

Hi @dromoded. Thank you for your report. The issue has been fixed in magento/magento2#12872 by @PieterCappelle in 2.3-develop branch Related commit(s):

The fix will be available with the upcoming patch release.

dmanners commented 6 years ago

@PieterCappelle again another image related one. Could you again validate what the next steps if any should be for this issue.

dmanners commented 5 years ago

This has been covered by https://github.com/magento/magento2/pull/12872