Project

Profile

Help

Issue #6223

Pulp configured with S3 doesn't include file type extension in Content-Disposition header

Added by chouseknecht over 1 year ago. Updated 12 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 68
Quarter:

Description

After Pulp redirects the user to Amazon S3 to download the file the user receives it but it does not have the correct file extension. The Artifact extension is something stored in Pulp's database. It's also possible that one Artifact is present in multiple repos as various filenames so this needs to be set as a per-request piece of data.

Associated revisions

Revision 9c32bd02 View on GitHub
Added by Fabricio Aguiar over 1 year ago

Including file type extension

https://pulp.plan.io/issues/6223 closes #6223

Revision 5ddf15d9 View on GitHub
Added by Fabricio Aguiar over 1 year ago

Fix extension migration

https://pulp.plan.io/issues/6223 ref #6223

History

#1 Updated by fao89 over 1 year ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 67

#2 Updated by fao89 over 1 year ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89

#3 Updated by fao89 over 1 year ago

I tested it out and it seems to be delivering Content-Disposition:

(pulp) [vagrant@pulp3-source-fedora30 pulp_file]$ http http://pulp3-source-fedora30.localhost.example.com/pulp/content/d25030e3-cfdd-4b48-9b15-f3c5fd7e8767/1.iso                             
HTTP/1.1 302 Found                                                                                                                                                                            
Connection: keep-alive                                                                                                                                                                        
Content-Length: 10                                                                                                                                                                            
Content-Type: text/plain; charset=utf-8                                                                                                                                                       
Date: Wed, 04 Mar 2020 18:39:58 GMT                                                                                                                                                           
Location: http://localhost:9000/pulp3/artifact/02/77b750a47e23de8a391ca5ccfa00e8dbb19419814a229d31f1d7ba382783d2?response-content-disposition=attachment%3Bfilename%3D1.iso&X-Amz-Algorithm=A$
S4-HMAC-SHA256&X-Amz-Credential=AKIAIT2Z5TDYPX3ARJBA/20200304/eu-central-1/s3/aws4_request&X-Amz-Date=20200304T183958Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=e8eae4f9f1$1bd0288a1970e4f7a188be4f69c6d443a1a76a1e1e59b333c0d5b
Server: nginx/1.16.1

302: Found

(pulp) [vagrant@pulp3-source-fedora30 pulp_file]$ http --follow http://pulp3-source-fedora30.localhost.example.com/pulp/content/d25030e3-cfdd-4b48-9b15-f3c5fd7e8767/1.iso
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Disposition: attachment;filename=1.iso
Content-Length: 1024
Content-Security-Policy: block-all-mixed-content
Content-Type: application/octet-stream
Date: Wed, 04 Mar 2020 18:40:03 GMT
ETag: "4a0a5bb0213434a6d1201dfed4a8794a"
Last-Modified: Wed, 04 Mar 2020 18:37:27 GMT
Server: MinIO/RELEASE.2020-02-27T00-23-05Z
Vary: Origin
X-Amz-Request-Id: 15F92DE48BA99B36
X-Xss-Protection: 1; mode=block



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+

(pulp) [vagrant@pulp3-source-fedora30 pulp_file]$ http -d http://pulp3-source-fedora30.localhost.example.com/pulp/content/d25030e3-cfdd-4b48-9b15-f3c5fd7e8767/1.iso
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Disposition: attachment;filename=1.iso
Content-Length: 1024
Content-Security-Policy: block-all-mixed-content
Content-Type: application/octet-stream
Date: Wed, 04 Mar 2020 18:40:14 GMT
ETag: "4a0a5bb0213434a6d1201dfed4a8794a"
Last-Modified: Wed, 04 Mar 2020 18:37:27 GMT
Server: MinIO/RELEASE.2020-02-27T00-23-05Z
Vary: Origin
X-Amz-Request-Id: 15F92DE7093849EA
X-Xss-Protection: 1; mode=block

Downloading 1.00 kB to "1.iso"
Done. 1.00 kB in 0.00043s (2.29 MB/s)

But from here I can see Content-Disposition is set based on relative_path: https://github.com/pulp/pulpcore/blob/master/pulpcore/content/handler.py#L558-L559

content_disposition = f'attachment;filename={content_artifact.relative_path}'

from my test, it worked with 1.iso because:

In [1]: [o.relative_path for o in ContentArtifact.objects.all()]                              
Out[1]: ['1.iso', '2.iso', '3.iso', 'PULP_MANIFEST']

#4 Updated by bmbouter over 1 year ago

Maybe uploading the content instead causes it to be entered in the db differently? Does content created from this test also have the file extension in the db?

#5 Updated by fao89 over 1 year ago

you were right, for that test:

In [1]: [o.relative_path for o in ContentArtifact.objects.all()]                              
Out[1]: ['pulp.nvymlldlmyekgkkdnnhrbpybwo.1.0.0']

#6 Updated by bmbouter over 1 year ago

That is great! Can that be fixed, and also an assertion added on it being correct in the tests maybe?

Also I think it needs a database migration since the code is in production on automation hub already. Would you be willing to add a database migration also? Let me know if you want to collaborate on how to write that or test it.

#7 Updated by fao89 over 1 year ago

  • Status changed from ASSIGNED to POST

#8 Updated by rchan over 1 year ago

  • Sprint changed from Sprint 67 to Sprint 68

#9 Updated by Anonymous over 1 year ago

  • Status changed from POST to MODIFIED

#10 Updated by daviddavis over 1 year ago

  • Project changed from Pulp to Ansible Plugin

#11 Updated by fao89 about 1 year ago

  • Sprint/Milestone set to 0.2.0

#12 Updated by bmbouter 12 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF