Hello Artifactory Team.

  I set up a cloud artifactory account and tried deploying an artifact
through REST API. When I try to download the artifact i see
content-disposition headers getting into the content of the file. I am not
sure if this is a bug in the REST API or if I am doing something wrong.
Below is the code. Please, help.



(venv)➜  commands git:(enhancement_fixes) ✗ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import requests
>>> import json
>>> import urllib2
>>> import urllib
>>> import os
>>> from requests.auth import HTTPBasicAuth
>>> from BeautifulSoup import BeautifulSoup
>>>
>>>
>>> url = 'https://xyz/raka/libs-release-local/aaddt111'
>>>
>>> files = {'file': open('/tmp/hhh', 'rb')}
>>>
>>>
>>>
>>> res = requests.put(url,  auth=HTTPBasicAuth('admin', ‘xxxx’), 
>>> files=files)
>>>
>>>
>>>
>>> res.text
u'{\n  "repo" : "libs-release-local",\n  "path" : "/aaddt111",\n  "created"
: "2015-09-15T06:32:41.156Z",\n  "createdBy" : "admin",\n  "downloadUri" :
"http://xyz.artifactoryonline.com/raka/libs-release-local/aaddt111",\n 
"mimeType" : "application/octet-stream",\n  "size" : "168",\n  "checksums" :
{\n    "sha1" : "91fbcaf653d232becefd3e9e25c118d0f641f4c1",\n    "md5" :
"97a945633a9a948b0c3f0be061ee2089"\n  },\n  "originalChecksums" : {\n  },\n 
"uri" :
"http://xyz.artifactoryonline.com/raka/libs-release-local/aaddt111"\n}'
>>>
>>>
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
(venv)➜  commands g ✗
(venv)➜  commands git:(enhancement_fixes) ✗ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import requests
>>> from requests.auth import HTTPBasicAuth
>>>
>>> r =
>>> requests.get('http://xyz.artifactoryonline.com/raka/libs-release-local/aaddt111',
>>> auth=HTTPBasicAuth('admin', ‘xxxx’))
>>>
>>> r.text
u'--0bcbdefba7804f7aade9454b48233091\r\nContent-Disposition: form-data;
name="file";
filename="hhh"\r\n\r\nhelolloks\n\ndadsmadsm\nasdads\n\n\r\n--0bcbdefba7804f7aade9454b48233091--\r\n'
>>> 


If you see above the r.text output the Content-Disposition got mixed with
content.





--
View this message in context: 
http://forums.jfrog.org/Content-disposition-header-making-into-content-with-REST-API-tp7580466.html
Sent from the Artifactory - Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to