aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/reportManager
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/reportManager')
-rw-r--r--src/client/util/reportManager/ReportManager.tsx1
-rw-r--r--src/client/util/reportManager/reportManagerUtils.ts10
2 files changed, 10 insertions, 1 deletions
diff --git a/src/client/util/reportManager/ReportManager.tsx b/src/client/util/reportManager/ReportManager.tsx
index 08467448d..802a2f09f 100644
--- a/src/client/util/reportManager/ReportManager.tsx
+++ b/src/client/util/reportManager/ReportManager.tsx
@@ -126,6 +126,7 @@ export class ReportManager extends React.Component<{}> {
let formattedLinks: string[] = [];
if (this.formData.mediaFiles.length > 0) {
const links = await uploadFilesToServer(this.formData.mediaFiles);
+ console.log('Links', links);
if (links) {
formattedLinks = links;
}
diff --git a/src/client/util/reportManager/reportManagerUtils.ts b/src/client/util/reportManager/reportManagerUtils.ts
index b95417aa1..948229442 100644
--- a/src/client/util/reportManager/reportManagerUtils.ts
+++ b/src/client/util/reportManager/reportManagerUtils.ts
@@ -89,7 +89,13 @@ export const fileLinktoServerLink = (fileLink: string): string => {
const regex = 'public';
const publicIndex = fileLink.indexOf(regex) + regex.length;
- const finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1).replace('.', '_l.')}`;
+ let finalUrl: string = '';
+ if (fileLink.includes('.png') || fileLink.includes('.jpg') || fileLink.includes('.jpeg') || fileLink.includes('.gif')) {
+ finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1).replace('.', '_l.')}`;
+ } else {
+ finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1)}`;
+ }
+
return finalUrl;
};
@@ -108,9 +114,11 @@ export const getServerPath = (link: any): string => {
* @returns the server paths or undefined on error
*/
export const uploadFilesToServer = async (mediaFiles: FileData[]): Promise<string[] | undefined> => {
+ console.log(mediaFiles);
try {
// need to always upload to browndash
const links = await Networking.UploadFilesToServer(mediaFiles.map(file => ({ file: file.file })));
+ console.log('Raw links', links);
return (links ?? []).map(getServerPath).map(fileLinktoServerLink);
} catch (err) {
if (err instanceof Error) {