#OI-I3: Fix: Mandatory header required during azure blob upload#367
#OI-I3: Fix: Mandatory header required during azure blob upload#367
Conversation
WalkthroughThe changes add Azure Blob Storage type configuration and enhance the upload flow to construct and pass custom headers during file uploads, with conditional support for Azure-specific blob type headers based on the cloud storage provider. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Controller as ConnectorRegister<br/>Controller
participant Config
participant Azure as Azure Blob<br/>Storage
Client->>Controller: Upload request
Controller->>Config: Read cloud config<br/>(provider, azure_blob_type)
Config-->>Controller: Config data
Controller->>Controller: Construct uploadHeaders<br/>(Content-Type, Content-Length)
alt Azure Provider
Controller->>Controller: Add x-ms-blob-type header<br/>from config
end
Controller->>Azure: axios.put(url, data,<br/>uploadHeaders)
Azure-->>Controller: Upload response
Controller-->>Client: Return result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
api-service/src/configs/Config.ts (1)
95-106: Azure blob type config is wired correctly; consider clarifying/validating expected values.The new
cloud_config.azure_blob_typedefaulting to"BlockBlob"is a good fit for Azure uploads and aligns with how it’s used inConnectorRegisterController.ts. To avoid subtle misconfig issues later, you may want to:
- Document the allowed values (
BlockBlob,AppendBlob,PageBlob, etc.) alongside this config, and/or- Add lightweight validation where this is consumed so obviously invalid values fail fast.
Functionally this looks good as-is.
api-service/src/controllers/ConnectorRegister/ConnectorRegisterController.ts (1)
12-13: Azure upload headers look correct; consider normalizing the provider name.The new
uploadHeaders(Content-Type + Content-Length) and conditional addition ofx-ms-blob-typefromconfig.cloud_config.azure_blob_typewhencloud_storage_provider === "azure"align well with Azure’s requirement for this header and keep other providers unaffected.One minor robustness tweak you might consider:
- if (config.cloud_config.cloud_storage_provider === "azure") { + if (config.cloud_config.cloud_storage_provider?.toLowerCase() === "azure") { uploadHeaders["x-ms-blob-type"] = config.cloud_config.azure_blob_type; }This avoids issues if
cloud_storage_provideris configured as"Azure"/"AZURE"while still keeping behavior unchanged for other values.Overall, the header construction and usage in
axios.putlook good.Also applies to: 81-92
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
api-service/src/configs/Config.ts(4 hunks)api-service/src/controllers/ConnectorRegister/ConnectorRegisterController.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
api-service/src/controllers/ConnectorRegister/ConnectorRegisterController.ts (1)
api-service/src/configs/Config.ts (1)
config(20-154)
🔇 Additional comments (1)
api-service/src/controllers/ConnectorRegister/ConnectorRegisterController.ts (1)
27-34: Early failure when signed URL is missing is a solid improvement.The explicit check on
urlPayload.download_urland throwingSIGNED_URL_NOT_FOUNDwith a 400 status avoids proceeding with an invalid URL and makes the failure mode clearer to callers. No issues from my side here.
|
The changes looks fine |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.