Skip to content

Commit 93351a8

Browse files
authored
Merge pull request #1481 from ImagingDataCommons/idc-prod-sp
Small bugfixes
2 parents 51e6478 + 4aae54d commit 93351a8

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

static/js/downloader.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,18 @@ require([
184184
if (key !== "") {
185185
const keys = key.split("/");
186186
const instance = keys[keys.length - 1];
187-
s3_urls.push({
188-
'url': `https://${this.bucket}.s3.us-east-1.amazonaws.com/${key}`,
189-
'study': this.study_id,
190-
'collection': this.collection_id,
191-
'series': this.series_id,
192-
'modality': this.modality,
193-
'instance': instance,
194-
'patient': this.patient_id,
195-
'directory': this.directory
196-
});
187+
if(instance.length > 0) {
188+
s3_urls.push({
189+
'url': `https://${this.bucket}.s3.us-east-1.amazonaws.com/${key}`,
190+
'study': this.study_id,
191+
'collection': this.collection_id,
192+
'series': this.series_id,
193+
'modality': this.modality,
194+
'instance': instance,
195+
'patient': this.patient_id,
196+
'directory': this.directory
197+
});
198+
}
197199
}
198200
});
199201
});
@@ -445,12 +447,16 @@ require([
445447
await outputStream.close();
446448
self.postMessage({message: "done", path: s3_url, localFilePath: filePath, size: response.headers.get('content-length')});
447449
} catch (error) {
448-
let msg = error.name || "Unnamed Error" + " when attempting to fetch URL " + s3_url;
450+
let msg = (error.name || "Unnamed Error") + " when attempting to fetch URL " + s3_url;
449451
if(error.name === "AbortError" || (error.name === undefined && pending_abort)) {
450452
msg = "Fetch was aborted. The user may have cancelled their downloads.";
451453
} else {
452-
console.error(msg);
453-
console.error(error);
454+
console.error("[Worker Error]", error.name);
455+
console.error("[Worker Error]", error.message);
456+
if(error.message.indexOf("getFileHandle") >= 0) {
457+
console.error("[Worker Error] File name attempted: ",fileName);
458+
}
459+
console.error("[Worker Error] on S3 target ", s3_url);
454460
}
455461
self.postMessage({message: 'error', path: s3_url, error: error, 'text': msg});
456462
}

0 commit comments

Comments
 (0)