aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-08-25 00:14:32 -0400
committerMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-08-25 00:14:51 -0400
commite1efc192ec6105c97c59f313e6efcbc617ff65d5 (patch)
treeb48c566d314d5b1d57c4c4c5f3eca154d9f32b43
parenta285e96aad715a8a1bd81fb0eda7fa3f94ac8156 (diff)
update the way to show the links
-rw-r--r--src/client/util/ReportManager.tsx19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index b36e7e063..d680b47ac 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -104,6 +104,20 @@ export class ReportManager extends React.Component<{}> {
}
}
+ // turns an upload link into a servable link
+ // ex:
+ // C: /Users/dash/Documents/GitHub/Dash-Web/src/server/public/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
+ // -> http://localhost:1050/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
+ private fileLinktoServerLink = (fileLink: string) => {
+ const serverUrl = 'https://browndash.com/';
+
+ const regex = 'public'
+ const publicIndex = fileLink.indexOf(regex) + regex.length;
+
+ const finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1)}`;
+ return finalUrl;
+ }
+
public async reportIssue() {
if (this.bugTitle === '' || this.bugDescription === ''
|| this.bugType === '' || this.bugPriority === '') {
@@ -111,14 +125,15 @@ export class ReportManager extends React.Component<{}> {
return;
}
-
if (this.toGithub) {
+ const formattedLinks = (this.fileLinks ?? []).map(this.fileLinktoServerLink)
+
const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', {
owner: 'brown-dash',
repo: 'Dash-Web',
title: this.formatTitle(this.bugTitle, Doc.CurrentUserEmail),
- body: `${this.bugDescription} \n\nfiles:\n${(this.fileLinks ?? []).join('\n')}`,
+ body: `${this.bugDescription} \n\nfiles:\n${formattedLinks.join('\n')}`,
labels: [
'from-dash-app',
this.bugType,