Skip to content

feat(azure-storage-blob): support hierarchical blob names - #888

Open
obaseyi2 wants to merge 1 commit into
unjs:mainfrom
obaseyi2:feat/azure-blob-nested-paths
Open

obaseyi2 wants to merge 1 commit into
unjs:mainfrom
obaseyi2:feat/azure-blob-nested-paths

Conversation

@obaseyi2

@obaseyi2 obaseyi2 commented Dec 1, 2026 •

Copy link
Copy Markdown

Add useHierarchicalKeys so the Azure Blob driver can store nested keys as slash-separated blob names. Reads, writes, metadata, listing, and deletion use the same mapping. The option defaults to false, and enabling it does not rename existing blobs.

Verified against Azurite.

Closes #709

Summary by CodeRabbit

  • New Features
    • Azure Blob Storage can now use slash-separated blob names for nested keys when hierarchical keys are enabled. The option is off by default; existing keys continue to use the default format unless configured otherwise.
  • Documentation
    • Azure Blob Storage guidance now explains the new option and notes that it does not migrate existing blobs. Use a new container or rename existing blobs before enabling it.

@obaseyi2
obaseyi2 requested a review from pi0 as a code owner December 1, 2026 14:59
@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown

@obaseyi2 is attempting to deploy a commit to the unjs Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Azure Blob Storage driver adds useHierarchicalKeys, which defaults to false. When enabled, the driver maps colons in keys to slashes in blob names across storage operations and filters listed names. Documentation and an Azurite integration test describe and verify the option.

Changes: Azure hierarchical blob keys

Layer / File(s) Summary
Hierarchical key mapping and validation
src/drivers/azure-storage-blob.ts, docs/2.drivers/azure.md, test/drivers/azure-storage-blob.test.ts
The driver adds useHierarchicalKeys and applies key-to-blob-name mapping to reads, writes, existence checks, removals, and metadata lookups. Listing normalizes and filters blob names when the option is enabled. The documentation notes that existing blobs are not migrated. The Azurite test checks flat and hierarchical storage behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Possibly related PRs

  • unjs/unstorage#870: Changes the same Azure Blob driver to support nested blob paths with an alternative option and key mapping.
Merge Risk: Minimal · up to e49e6

This adds an opt-in Azure Blob option for slash-separated nested keys and leaves default behavior unchanged. The documentation warns that existing blobs are not migrated. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(azure-storage-blob): support hierarchical blob names" names the primary change: a new useHierarchicalKeys option that maps nested keys to slash-separated blob names in the Azure Blob d…
Linked Issues check Passed [#709] Requirement: allow nested blob paths in the Azure driver so setItem and setItemRaw do not replace / with :. The reviewed head adds useHierarchicalKeys (default false) to `AzureStora…
Out of Scope Changes check Passed All changes relate to the linked requirement. The driver change in src/drivers/azure-storage-blob.ts adds the option, the mapping helper, and the getKeys filtering that skips names that would not …
Full details: Title check

Explanation

The title "feat(azure-storage-blob): support hierarchical blob names" names the primary change: a new useHierarchicalKeys option that maps nested keys to slash-separated blob names in the Azure Blob driver. It is specific, concise, and matches the summary, objectives, and linked issue #709 about nested blob paths. The title is not vague and does not describe unrelated work.

Full details: Linked Issues check

Explanation

[#709] Requirement: allow nested blob paths in the Azure driver so setItem and setItemRaw do not replace / with :. The reviewed head adds useHierarchicalKeys (default false) to AzureStorageBlobOptions. When enabled, toBlobName replaces : with /, and getBlobClient uses that mapping. hasItem, getItem, getItemRaw, setItem, setItemRaw, removeItem, and getMeta all call getBlobClient, so they share the mapping. getKeys maps blob names back to keys when the option is enabled. The issue suggests allowNestedPath, but it says 'or something similar', so the different name is acceptable. The PR summary reports a new Azurite-backed test that checks write, read, metadata, listing, and removal with the option enabled. That test was not read directly. The option defaults to false, so existing behavior is unchanged. The issue's proposed approach is covered.

Full details: Out of Scope Changes check

Explanation

All changes relate to the linked requirement. The driver change in src/drivers/azure-storage-blob.ts adds the option, the mapping helper, and the getKeys filtering that skips names that would not round-trip. The docs/2.drivers/azure.md change documents the new option. The test file adds an Azurite integration test for the option. The head file was read directly. The diff tool was unavailable, so the change set was checked from the file content and the PR summary. No unrelated changes were found in the supplied evidence.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c262db34-1798-455a-b579-41d3c6365f8c
Commits

Reviewing files that changed from the base of the PR and between 5781aae and e49e623.

Files selected for processing: 3

  • docs/2.drivers/azure.md
  • src/drivers/azure-storage-blob.ts
  • test/drivers/azure-storage-blob.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Denormalising Keys for Azure Storage

1 participant