Open Xprogrammer777 opened 6 months ago
You should edit your logfile and remove the Authorization header.
I have the exact same issue with my upload script - however not on all machines. I use 3 machines, each on different architectures and different locations, resulting in different ISPs. 1 of the 3 still works. You can check the debug log of the request, which is written to /tmp/du_resp_debug
. For me I get a HTTP 409 conflict with the error incorrect_offset. I was able to fix the issue in the shell script, however just using the most recent script worked as well. So if you are using an older version of the upload script, please update. If the issue still persists, you can do this in the shell script to retrieve the correct offset from the debug file and modify your request. There are just a few lines added, you will easily find out which lines by comparison. Just search for the correct while
, there's only one with the error message An error occurred requesting /chunked_upload
while [[ $OFFSET != "$FILE_SIZE" ]]; do
let OFFSET_MB=$OFFSET/1024/1024
# Create the chunk
dd if="$FILE_SRC" of="$CHUNK_FILE" bs=1048576 skip=$OFFSET_MB count=$CHUNK_SIZE 2> /dev/null
local CHUNK_REAL_SIZE=$(file_size "$CHUNK_FILE")
if [[ $VERBOSE == 1 ]]; then
print " >> Uploading chunk $chunkNumber of $NUMBEROFCHUNK\n"
fi
# Uploading the chunk...
echo > "$RESPONSE_FILE"
$CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST $CURL_PARAMETERS --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"cursor\": {\"session_id\": \"$SESSION_ID\",\"offset\": $OFFSET},\"close\": false}" --header "Content-Type: application/octet-stream" --data-binary @"$CHUNK_FILE" "$API_CHUNKED_UPLOAD_APPEND_URL"
# Check HTTP response code
HTTP_CODE=$(awk '/^HTTP\// {print $2}' "$RESPONSE_FILE")
if [[ $HTTP_CODE == 200 ]]; then
let OFFSET=$OFFSET+$CHUNK_REAL_SIZE
UPLOAD_ERROR=0
if [[ $VERBOSE != 1 ]]; then
print "."
fi
((chunkNumber=chunkNumber+1))
elif [[ $HTTP_CODE == 409 ]]; then
# Parsing response file for correct offset
CORRECT_OFFSET=$(grep -o '"correct_offset": [0-9]*' "$RESPONSE_FILE" | awk '{print $2}')
OFFSET=$CORRECT_OFFSET
else
if [[ $VERBOSE != 1 ]]; then
print "*"
fi
let UPLOAD_ERROR=$UPLOAD_ERROR+1
# On error, the upload is retried for max 3 times
if [[ $UPLOAD_ERROR -gt 2 ]]; then
print " FAILED\n"
print "An error occurred requesting /chunked_upload\n"
ERROR_STATUS=1
return
fi
fi
done
I ran with -d to know where the error was coming from but didn't understand anything: