cyrillef / forge.commandline-curl

Authorization and file translation demo: Demonstrates Autodesk Forge API authorization and translation process using cURL
MIT License
12 stars 8 forks source link

spaces in file path corrupt location #5

Closed jeremytammik closed 9 years ago

jeremytammik commented 9 years ago

i uploaded the following file from my windows file system:

/a/src/web/viewer/git/workflow-curl-view.and.data.api/ $ ./viewerAPI upload "/v/C/Program Files/Autodesk/Revit 2016/Samples/rst_advanced_sample_project.rvt" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.2M 100 499 100 11.2M 3 82150 0:02:46 0:02:23 0:00:23 21352 { "bucket-key": "comphound-bucket", "objects": [ { "content-type": "application/octet-stream", "id": "urn:adsk.objects:os.object:comphound-bucket/Program+Revit+rst_advanced_sample_project.rvt", "key": "Program+Revit+rst_advanced_sample_project.rvt", "location": "https://developer.api.autodesk.com/oss/v1/buckets/comphound-bucket/objects/Program+Revit+rst_advanced_sample_project.rvt", "sha-1": "8b7e00fbed8f80467b6a54b37f7fdcace2044236", "size": 11792384 } ] } ID: urn:adsk.objects:os.object:comphound-bucket/Program+Revit+rst_advanced_sample_project.rvt Location: https://developer.api.autodesk.com/oss/v1/buckets/comphound-bucket/objects/Program+Revit+rst_advanced_sample_project.rvt

look at the resulting location: it includes the first word of some intermediate folder names!

when i try to register, it is not obviously found:

/a/src/web/viewer/git/workflow-curl-view.and.data.api/ $ ./viewerAPI register rst_advanced_sample_project.rvt cat: /Users/jta/a/src/web/viewer/git/workflow-curl-view.and.data.api/data/comphound-bucket.rst_advanced_sample_project.rvt.json: No such file or directory Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 290, in load kw) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init*.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 53 100 43 100 10 45 10 0:00:01 --:--:-- 0:00:01 102 Registration submission failed! HTTP/1.1 400 Bad Request Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: \ Content-Type: application/json; charset=utf-8 Date: Thu, 01 Oct 2015 15:19:56 GMT Server: Apigee Router x-ads-app-identifier: platform-viewing-2015.06.6.1053.c60682a-production x-ads-duration: 0 ms x-ads-error-id: x-ads-exception-id: 19fed11e-50dd-454d-a1f9-309e62e700e4 x-ads-startup-time: Thu Oct 01 03:07:15 UTC 2015 x-ads-troubleshooting: The request is invalid. Content-Length: 43 Connection: keep-alive {"diagnostic":"'urn' parameter is invalid"}

cyrillef commented 9 years ago

Hi Jeremy, I tried with ./viewerAPI upload "/c/temp/AREA Autodesk University_files/Au Test.obj" with no problem, let me know when you can share your screen to debug together

jeremytammik commented 9 years ago

hi cyrille, may the problem be caused by the fact that the folder containing the sample is on the virtual Windows C: drive generated by parallels?

cyrillef commented 9 years ago

Hi Jeremy, I doubt, the code simply reads the bytes to upload, and the file seems to have uploaded properly. And the path given which cause the problem, is a string you entered manually, with forward slash. So everything looks ok, but it is not :( I tried here and it is working. If it happens again, let me know and will debug together - there should be a good reason, but I am clueless for now :S