Skip to content

Commit 7d73909

Browse files
committed
Update MongoDB_FileWorkspaceMap.backend_fileReadInputStream method to download latest revision of a file.
1 parent 7588012 commit 7d73909

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/picoded/dstack/mongodb/MongoDB_FileWorkspaceMap.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,15 @@ public byte[] backend_fileRead(String oid, String filepath) {
677677
**/
678678
public InputStream backend_fileReadInputStream(String oid, String filepath) {
679679
try {
680-
return gridFSBucket.openDownloadStream(oid + "/" + filepath);
680+
681+
// id of the file to download
682+
return gridFSBucket.openDownloadStream(
683+
// name of the file to download
684+
oid + "/" + filepath,
685+
// set the revision number to -1 to download the latest copy of the file
686+
new GridFSDownloadOptions().revision(-1)
687+
);
688+
681689
} catch (Exception e) {
682690
if (e.getMessage().toLowerCase().indexOf("no file found") >= 0) {
683691
// Does nothing if no file is found

0 commit comments

Comments
 (0)