Skip to content

Commit

Permalink
remove extranious container name
Browse files Browse the repository at this point in the history
  • Loading branch information
devhawk committed Sep 17, 2024
1 parent 1386c47 commit 5b57d2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/backend/src/functions/httpTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ async function upload(client: ContainerClient, deviceKey: Uint8Array, data: Buff

let blobName;
if (type === 'prov') {
blobName = `${client.containerName}/prov/${deviceID}/${blobID}`;
blobName = `prov/${deviceID}/${blobID}`;
} else if (type === 'attach') {
blobName = `${client.containerName}/attach/${blobID}`;
blobName = `attach/${blobID}`;
} else {
throw new Error(`Invalid type provided: ${type}. Expected 'prov' or 'attach'.`);
}
Expand Down Expand Up @@ -152,7 +152,7 @@ async function getProvenance(request: HttpRequest, context: InvocationContext):
if (!containerExists) { return { jsonBody: [] }; }

const records = new Array<ProvenanceRecord & { deviceID: string, timestamp: number }>();
for await (const blob of containerClient.listBlobsFlat({ prefix: `gosqas/prov/${deviceID}` })) {
for await (const blob of containerClient.listBlobsFlat({ prefix: `prov/${deviceID}` })) {
const blobClient = containerClient.getBlockBlobClient(blob.name);
const { data, timestamp } = await decryptBlob(blobClient, deviceKey);
const json = new TextDecoder().decode(data);
Expand All @@ -172,7 +172,7 @@ async function getDecryptedBlob(request: HttpRequest, context: InvocationContext
const containerExists = await containerClient.exists();
if (!containerExists) { return undefined; }

const blobClient = containerClient.getBlockBlobClient(`gosqas/attach/${attachmentID}`);
const blobClient = containerClient.getBlockBlobClient(`attach/${attachmentID}`);
const exists = await blobClient.exists();
if (!exists) { return undefined; }

Expand Down

0 comments on commit 5b57d2f

Please sign in to comment.