Skip to content

Commit 5fdb039

Browse files
authored
Update deepimagej-app.imjoy.html
1 parent e09e984 commit 5fdb039

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/deepimagej-app.imjoy.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
showProgress(progressEvent.loaded/progressEvent.total)
7070
}
7171
})
72-
const filename = url.split('/').pop().split('#')[0].split('?')[0];
72+
const filename = getFileName(url).slice(2);
7373
// const blob = new Blob([response.data]);
7474
// const file = new File([blob], filename, {type: "application/octet-stream", lastModified: Date.now()});
7575
return {name: filename, data: new Uint8Array(response.data)}
@@ -85,7 +85,11 @@
8585
}
8686

8787
function getFileName(url){
88-
return './' + url.split('/').pop().split('#')[0].split('?')[0]
88+
const parts = url.split('/');
89+
// Remove the last element 'content'
90+
parts.pop();
91+
// Take the last element which should be the file name
92+
return './' + parts.pop().split('#')[0].split('?')[0];
8993
}
9094

9195
async function fileExists(rootUrl, url){

0 commit comments

Comments
 (0)