diff options
author | Stanley Yip <stanley_yip@brown.edu> | 2020-05-23 22:27:06 -0700 |
---|---|---|
committer | Stanley Yip <stanley_yip@brown.edu> | 2020-05-23 22:27:06 -0700 |
commit | 577e93f075e44277254f096ae8bf769a239ebd33 (patch) | |
tree | 3b4562befa8124fb5b4d6294e3a94529a27fe30c /src/server/DashUploadUtils.ts | |
parent | 1113da5f2db22bd2b2b457b1f5b183d7f1f2e68d (diff) | |
parent | 19ababdb6098ac36358c86e43ad63ab3066b4663 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/server/DashUploadUtils.ts')
-rw-r--r-- | src/server/DashUploadUtils.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index c887aa4e6..2bf4c1956 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -15,7 +15,9 @@ const parse = require('pdf-parse'); import { Directory, serverPathToFile, clientPathToFile, pathToDirectory } from './ApiManagers/UploadManager'; import { red } from 'colors'; import { Stream } from 'stream'; +import { resolvedPorts } from './server_Initialization'; const requestImageSize = require("../client/util/request-image-size"); +import { resolvedServerUrl } from "./server_Initialization"; export enum SizeSuffix { Small = "_s", @@ -184,7 +186,7 @@ export namespace DashUploadUtils { if (error !== null) { return error; } - source = `http://localhost:1050${clientPathToFile(Directory.images, resolved)}`; + source = `${resolvedServerUrl}${clientPathToFile(Directory.images, resolved)}`; } let resolvedUrl: string; /** @@ -194,14 +196,14 @@ export namespace DashUploadUtils { * basename subtree (i.e. /images/<some_guid>.<ext>) and put it on the end of the server's url. * * This can always be localhost, regardless of whether this is on the server or not, since we (the server, not the client) - * will be the ones making the request, and from the perspective of dash-release or dash-web, localhost:1050 refers to the same thing - * as the full dash-release.eastus.cloudapp.azure.com:1050. + * will be the ones making the request, and from the perspective of dash-release or dash-web, localhost:<port> refers to the same thing + * as the full dash-release.eastus.cloudapp.azure.com:<port>. */ const matches = isLocal().exec(source); if (matches === null) { resolvedUrl = source; } else { - resolvedUrl = `http://localhost:1050/${matches[1].split("\\").join("/")}`; + resolvedUrl = `${resolvedServerUrl}/${matches[1].split("\\").join("/")}`; } // See header comments: not all image files have exif data (I believe only JPG is the only format that can have it) const exifData = await parseExifData(resolvedUrl); |