Skip to content

Commit a809901

Browse files
author
seeland
committed
Fix: title extraction from s3-url without query parameters like tokens
1 parent 70c4716 commit a809901

File tree

1 file changed

+9
-2
lines changed
  • viplab-standalone-frontend-vue/src/components/csv-plots

1 file changed

+9
-2
lines changed

viplab-standalone-frontend-vue/src/components/csv-plots/CsvPlot.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,15 @@ export default {
176176
177177
// set x-Axis label and title
178178
// TODO: allow title in metadata? (id in dumux web-app)
179-
const lastIndex = this.csvs[this.fileIndex].lastIndexOf('/');
180-
const title = ((this.areUrlsProp) ? this.csvs[this.fileIndex].substr(lastIndex + 1, this.csvs[this.fileIndex].length) : 'Graph');
179+
let title = 'Graph';
180+
if (this.areUrlsProp) {
181+
let startIndex = this.csvs[this.fileIndex].lastIndexOf('/');
182+
startIndex = (startIndex != -1) ? startIndex : 0;
183+
let endIndex = this.csvs[this.fileIndex].lastIndexOf('?');
184+
endIndex = (endIndex != -1) ? endIndex : this.csvs[this.fileIndex].length;
185+
title = this.csvs[this.fileIndex].substring(startIndex + 1, endIndex);
186+
}
187+
181188
const xformat = (this.labelProp.format) ? this.labelProp.format : '.1f';
182189
const yformat = (this.datasetProp.format) ? this.datasetProp.format : '.1f';
183190
const ytext = this.datasetProp.label || ((keys.length <= 2) ? keys[1] : '');

0 commit comments

Comments
 (0)