File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1790,6 +1790,14 @@ export class NVSEditor {
17901790 * or extend the partition; the new payload must fit in the existing slots.
17911791 */
17921792 _uploadBlobToNVS ( blob , fileBytes ) {
1793+ // Refuse 0-byte uploads outright — replacing all chunks with an empty
1794+ // payload would leave the blob_index as an orphan (totalSize=0,
1795+ // chunkCount=0) which ESP-IDF NVS does not surface as a valid blob.
1796+ // Users who want to remove a blob should use the per-entry delete UI.
1797+ if ( fileBytes . length === 0 ) {
1798+ throw new Error ( "Cannot upload an empty file as blob replacement." ) ;
1799+ }
1800+
17931801 // Resolve the parsed data-chunk items (in chunk-index order) so we know
17941802 // each slot's offset/span and can size-check before mutating anything.
17951803 const sortedChunks = [ ...blob . chunks ] . sort ( ( a , b ) => a . index - b . index ) ;
You can’t perform that action at this time.
0 commit comments