iosfreak
iosfreak

Reputation: 5238

Dropbox partial upload

I'm working on getting CI working with Xcode server, so that we can automatically push updates internally. Everything is working on Dropbox's end, except the fact that the IPA is only partially uploaded.

It's not a large file - around 5.5mb. If I don't specify a "content-length", I get a 200, but it's not the complete file (around 2.7mb).

When I specify a "Content-Length", it times out and I get a: curl: (52) Empty reply from the server.

Here's part of my shell script:

DROPBOX_TOKEN="DROPBOX_TOKEN"
FILE_LOCATION="folder/App.ipa"

IPA="/path/to/IPA/App.ipa"
IPA_SIZE=`ls -l $IPA | awk '{print $5}'`

curl -i -X PUT "https://api-content.dropbox.com/1/files_put/auto/$FILE_LOCATION" \
-d @"$IPA" \
-H "Authorization: Bearer $DROPBOX_TOKEN" \
-H "Content-Type: application/octet-stream" \
-H "Content-Length: $IPA_SIZE"

I have confirmed that $IPA_SIZE (5473951 bytes) is equal to what I see in finder.

Upvotes: 1

Views: 402

Answers (1)

user94559
user94559

Reputation: 60143

(Just moving my comment into an answer for people who come across this later.)

You need to use --data-binary instead of -d to make sure curl doesn't do any modifications to the file contents.

Upvotes: 2

Related Questions