Skip to content

Commit 4387f3c

Browse files
committed
correct download link
1 parent c8270ac commit 4387f3c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/webapp/ui/src/eln/gallery/useGalleryListing.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ class RemoteFile implements GalleryFile {
632632
+modificationDate: Date;
633633
+path: $ReadOnlyArray<GalleryFile>;
634634
downloadHref: void | (() => Promise<UrlType>);
635+
logicPath: string;
635636
remotePath: string;
636637
#cachedDownloadHref: UrlType | void;
637638
@@ -642,7 +643,7 @@ class RemoteFile implements GalleryFile {
642643
fileSize,
643644
modificationDate,
644645
path,
645-
remotePath,
646+
logicPath,
646647
token,
647648
}: {|
648649
nfsId: number | null,
@@ -651,7 +652,7 @@ class RemoteFile implements GalleryFile {
651652
fileSize: number,
652653
modificationDate: Date,
653654
path: $ReadOnlyArray<GalleryFile>,
654-
remotePath: string,
655+
logicPath: string,
655656
token: string,
656657
|}) {
657658
this.nfsId = nfsId;
@@ -661,7 +662,8 @@ class RemoteFile implements GalleryFile {
661662
this.size = fileSize;
662663
this.modificationDate = modificationDate;
663664
this.path = path;
664-
this.remotePath = remotePath;
665+
this.logicPath = logicPath;
666+
this.remotePath = logicPath.split(":").slice(1).join(":");
665667
if (!this.isFolder) {
666668
const filestoreId = path[0].id;
667669
this.downloadHref = async () => {
@@ -670,7 +672,7 @@ class RemoteFile implements GalleryFile {
670672
idToString(this.id).do((id) => {
671673
urlSearchParams.append("remoteId", id);
672674
});
673-
urlSearchParams.append("remotePath", remotePath);
675+
urlSearchParams.append("remotePath", this.remotePath);
674676
const { data: blob } = await axios.get<Blob>(
675677
`/api/v1/gallery/filestores/${idToString(
676678
filestoreId
@@ -699,7 +701,7 @@ class RemoteFile implements GalleryFile {
699701
}
700702
701703
get key(): string {
702-
return this.remotePath;
704+
return this.logicPath;
703705
}
704706
705707
get extension(): string | null {
@@ -1398,7 +1400,7 @@ export function useGalleryListing({
13981400
.flatMap(Parsers.parseDate)
13991401
.elseThrow();
14001402
1401-
const remotePath = Parsers.getValueWithKey("logicPath")(obj)
1403+
const logicPath = Parsers.getValueWithKey("logicPath")(obj)
14021404
.flatMap(Parsers.isString)
14031405
.elseThrow();
14041406
@@ -1410,7 +1412,7 @@ export function useGalleryListing({
14101412
fileSize,
14111413
modificationDate,
14121414
path: pa,
1413-
remotePath,
1415+
logicPath,
14141416
token,
14151417
})
14161418
);

0 commit comments

Comments
 (0)