diff options
author | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-07-11 11:32:43 -0400 |
---|---|---|
committer | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-07-11 11:32:43 -0400 |
commit | a5194a874236eafc42a61c96d5b22c8622170149 (patch) | |
tree | cb5ca3325cfd88f865672cacad795fa73328607a /src | |
parent | 71a5c4a6ff126a256b4053d539b6099e5a429bbc (diff) |
clean up
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 2 | ||||
-rw-r--r-- | src/server/ApiManagers/AzureManager.ts | 11 | ||||
-rw-r--r-- | src/server/DashUploadUtils.ts | 6 |
3 files changed, 4 insertions, 15 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 43c9d2e7a..2532ef226 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -1736,9 +1736,7 @@ export namespace DocUtils { return; } const full = { ...options, _width: 400, title: name }; - // const pathname = Utils.prepend(result.accessPaths.agnostic.client); const pathname = result.accessPaths.agnostic.client; - // const pathname = result.accessPaths.azure.client; const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc); if (doc) { const proto = Doc.GetProto(doc); diff --git a/src/server/ApiManagers/AzureManager.ts b/src/server/ApiManagers/AzureManager.ts index 7e319f123..12bb98ad0 100644 --- a/src/server/ApiManagers/AzureManager.ts +++ b/src/server/ApiManagers/AzureManager.ts @@ -1,8 +1,6 @@ import { ContainerClient, BlobServiceClient } from "@azure/storage-blob"; -// import * as dotenv from 'dotenv'; import * as fs from "fs"; import { Readable, Stream } from "stream"; -// dotenv.config(); const AZURE_STORAGE_CONNECTION_STRING = process.env.AZURE_STORAGE_CONNECTION_STRING; export class AzureManager { @@ -15,9 +13,8 @@ export class AzureManager { constructor() { if (!AZURE_STORAGE_CONNECTION_STRING) { - throw Error("Azure Storage Connection String Not Found"); + throw new Error("Azure Storage Connection String Not Found"); } - // this._blobServiceClient = BlobServiceClient.fromConnectionString(process.env.AZURE_STORAGE_CONNECTION_STRING); this._blobServiceClient = BlobServiceClient.fromConnectionString(AZURE_STORAGE_CONNECTION_STRING); this._containerClient = this.BlobServiceClient.getContainerClient(AzureManager.CONTAINER_NAME); } @@ -35,7 +32,6 @@ export class AzureManager { } public static UploadBlob(filename: string, filepath: string, filetype: string) { - console.log("Upload Blob File"); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); const blobOptions = { blobHTTPHeaders: { blobContentType: filetype }}; const stream = fs.createReadStream(filepath); @@ -43,20 +39,17 @@ export class AzureManager { } public static UploadBlobStream(stream: Readable, filename: string, filetype: string) { - console.log("Upload Blob Stream: %s, %s", filename, filetype); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); const blobOptions = { blobHTTPHeaders: { blobContentType: filetype }}; return blockBlobClient.uploadStream(stream, undefined, undefined, blobOptions); } public static DeleteBlob(filename: string) { - console.log("Delete Blob from filename"); const blockBlobClient = this.Instance.ContainerClient.getBlockBlobClient(filename); return blockBlobClient.deleteIfExists(); } public static async GetBlobs() { - console.log("Get Blobs"); const foundBlobs = []; for await (const blob of this.Instance.ContainerClient.listBlobsFlat()) { console.log(`${blob.name}`); @@ -71,4 +64,4 @@ export class AzureManager { return foundBlobs; } -}
\ No newline at end of file +} diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index c33166d4a..bff60568b 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -192,7 +192,6 @@ export namespace DashUploadUtils { export async function upload(file: File, overwriteGuid?: string): Promise<Upload.FileResponse> { const isAzureOn = usingAzure(); - console.log("Azure usage: ", isAzureOn); const { type, path, name } = file; const types = type?.split('/') ?? []; uploadProgress.set(overwriteGuid ?? name, 'uploading'); // If the client sent a guid it uses to track upload progress, use that guid. Otherwise, use the file's name. @@ -204,7 +203,7 @@ export namespace DashUploadUtils { switch (category) { case 'image': if (imageFormats.includes(format)) { - const result = await UploadImage(path, basename(path), name); + const result = await UploadImage(path, basename(path)); return { source: file, result }; } fs.unlink(path, () => {}); @@ -334,12 +333,11 @@ export namespace DashUploadUtils { * 3) the size of the image, in bytes (4432130) * 4) the content type of the image, i.e. image/(jpeg | png | ...) */ - export const UploadImage = async (source: string, filename?: string, originalFilename?: string, prefix: string = ''): Promise<Upload.ImageInformation | Error> => { + export const UploadImage = async (source: string, filename?: string, prefix: string = ''): Promise<Upload.ImageInformation | Error> => { const metadata = await InspectImage(source); if (metadata instanceof Error) { return { name: metadata.name, message: metadata.message }; } - console.log(originalFilename); return UploadInspectedImage(metadata, filename || metadata.filename, prefix); }; |