From 5c62f3088e9802049a96b2c3e2dc70815ca6398f Mon Sep 17 00:00:00 2001 From: robbond Date: Thu, 26 Mar 2026 11:18:50 +0000 Subject: [PATCH] TASK22269: reuse azurestorage path builders in touched blob object fields --- actions/azurestorage.js | 50 +++++++++++++++++---------------------- memory-bank/change-log.md | 32 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index eb6b748d..ac3c5519 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -281,25 +281,21 @@ export const getBlobs = async (containerName, casefolderID) => { "size": blob.properties.contentLength, "contentType": blob.contentType, "lastModified": blob.properties.lastModified, - "filepath": - "/api/file/downloadblob?container=" + - containerName + - "&casefolderID=" + - encodeURIComponent(casefolderID) + - "&blobname=" + - encodeURIComponent(blob.name), + "filepath": buildDownloadBlobQueryPath({ + containerName, + casefolderID, + blobname: blob.name + }), ...buildHashMetadataPaths({ containerName, casefolderID, blobname: fileName }), - "deletepath": - "/api/file/deleteblob?container=" + - containerName + - "&casefolderID=" + - encodeURIComponent(casefolderID) + - "&blobname=" + - encodeURIComponent(fileName) + "deletepath": buildDeleteBlobQueryPath({ + containerName, + casefolderID, + blobname: fileName + }) }); } //console.log("blobObj:", blobObj); @@ -1487,25 +1483,23 @@ export const getRepsFilesBlobs = async ( "isCurrentVersion": blob.isCurrentVersion, "contentLength": blob.properties.contentLength, "filenameprefix": filenamePrefix, - "filepath": - "/api/file/downloadblob?container=" + - containerName + - "&casefolderID=" + - encodeURIComponent(casefolderPath) + - "&blobname=" + - encodeURIComponent(repFileName), + "filepath": buildDownloadBlobQueryPath({ + containerName, + casefolderID: casefolderPath, + blobname: repFileName + }), ...buildHashMetadataPaths({ containerName, casefolderID: casefolderPath, blobname: repFileName }), - "deletepath": - "/api/file/deleteblob?container=" + - containerName + - "&casefolderID=" + - casefolderPath + - "&blobname=" + - repFileName + "deletepath": buildDeleteBlobQueryPath({ + containerName, + casefolderID: casefolderPath, + blobname: repFileName, + encodeCasefolderID: false, + encodeBlobname: false + }) }); } consoleLogger("blobObj:", blobObj); diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index 789d170d..1646a9be 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -3100,3 +3100,35 @@ Validation: Follow-ups: - Optional next bounded slice: align remaining low-risk direct `console.log` calls in these functions to `consoleLogger` only where already touched and safe. + +--- + +### CL-087: TASK22269 Slice B1.12 — azurestorage touched-function path assembly helper reuse + +date: 2026-03-26 +author: Cline +scope: `actions/azurestorage.js` +type: change +rationale: Execute the next bounded maintainability slice by reusing existing local query-path helpers for touched `filepath`/`deletepath` assembly, reducing repeated literal concatenation. +impact: Readability/consistency improvement only; preserves query parameter values and route behavior. +status: completed + +Summary: + +- In touched functions: + - `getBlobs` + - `getRepsFilesBlobs` +- Replaced inline `filepath` string concatenation with `buildDownloadBlobQueryPath(...)`. +- Replaced inline `deletepath` string concatenation with `buildDeleteBlobQueryPath(...)`. +- Preserved previous encoding behavior where required by passing explicit options: + - kept non-encoded `casefolderID`/`blobname` behavior in `getRepsFilesBlobs.deletepath` via helper options. + +Validation: + +- `npm run lint` -> pass with warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors) +- `node tests/phase22/index.test.cjs` -> pass +- `node tests/phase7/service-behaviour.test.cjs` -> pass (13/13) + +Follow-ups: + +- Optional next bounded slice: targeted helper-consumer tidy in the same functions for any remaining repeated query-path literals outside touched object fields.