using bff

This commit is contained in:
pratik
2025-10-22 14:39:46 -05:00
parent 05d452c250
commit 4e24d93a5a
2 changed files with 51 additions and 4 deletions

View File

@@ -211,11 +211,14 @@ upload_file_in_chunks() {
echo "DEBUG: Uploading chunk to: $API_BASE/upload/chunk?uploadSessionId=$SESSION_ID&fileType=$file_type&chunkIndex=$chunk_index&totalChunks=$total_chunks&fileName=$file_name"
fi
# Send metadata as query params and chunk file as raw binary body
# This works with Java proxy that forwards body as-is
# Base64 encode the chunk so Java proxy can handle it as text/String
# This prevents corruption when proxy reads binary data as String
CHUNK_BASE64=$(base64 < "$chunk_file")
RESPONSE=$(curl -s -X POST "$API_BASE/upload/chunk?uploadSessionId=$SESSION_ID&fileType=$file_type&chunkIndex=$chunk_index&totalChunks=$total_chunks&fileName=$file_name" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$chunk_file")
-H "Content-Type: text/plain" \
-H "X-Chunk-Encoding: base64" \
-d "$CHUNK_BASE64")
if [ "$DEBUG_MODE" = "true" ]; then
echo "DEBUG: Chunk response: $RESPONSE"