diff options
| author | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-27 14:01:10 -0400 |
|---|---|---|
| committer | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-27 14:01:10 -0400 |
| commit | d655a8770ae4d4ff3cf08c433ac9068ed975aee4 (patch) | |
| tree | 41a710f1034e8ef095b0a9fe10f59e8fe33d227c /src/client/util/reportManager/reportManagerUtils.ts | |
| parent | 4ad1c765afcb0402f00ea6a91bf5811904e2a30e (diff) | |
| parent | 23382da2326108b8c81906ec9b353b3493c20a21 (diff) | |
Merge branch 'sophie-report-manager' into sophie-ai-images
Diffstat (limited to 'src/client/util/reportManager/reportManagerUtils.ts')
| -rw-r--r-- | src/client/util/reportManager/reportManagerUtils.ts | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/client/util/reportManager/reportManagerUtils.ts b/src/client/util/reportManager/reportManagerUtils.ts index d8344220f..b95417aa1 100644 --- a/src/client/util/reportManager/reportManagerUtils.ts +++ b/src/client/util/reportManager/reportManagerUtils.ts @@ -84,7 +84,7 @@ export const formatTitle = (title: string, userEmail: string): string => `${titl // C: /Users/dash/Documents/GitHub/Dash-Web/src/server/public/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2.png // -> https://browndash.com/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png export const fileLinktoServerLink = (fileLink: string): string => { - const serverUrl = 'https://browndash.com/'; + const serverUrl = window.location.href.includes('browndash') ? 'https://browndash.com/' : 'http://localhost:1050/'; const regex = 'public'; const publicIndex = fileLink.indexOf(regex) + regex.length; @@ -110,10 +110,7 @@ export const getServerPath = (link: any): string => { export const uploadFilesToServer = async (mediaFiles: FileData[]): Promise<string[] | undefined> => { try { // need to always upload to browndash - const links = await Networking.UploadFilesToServer( - mediaFiles.map(file => ({ file: file.file })), - true - ); + const links = await Networking.UploadFilesToServer(mediaFiles.map(file => ({ file: file.file }))); return (links ?? []).map(getServerPath).map(fileLinktoServerLink); } catch (err) { if (err instanceof Error) { |
