DATAMONGO-2021 - Use getObjectId() instead of getFilename() for opening the GridFS download stream.
Using the file name leads to duplicate resource streams as file names are not unique therefore we're using the file's ObjectId to lookup the file content. Original pull request: #581.
This commit is contained in:
committed by
Mark Paluch
parent
46ed58b465
commit
e18f506edd
@@ -240,7 +240,7 @@ public class GridFsTemplate implements GridFsOperations, ResourcePatternResolver
|
||||
|
||||
Assert.notNull(file, "GridFSFile must not be null!");
|
||||
|
||||
return new GridFsResource(file, getGridFs().openDownloadStream(file.getFilename()));
|
||||
return new GridFsResource(file, getGridFs().openDownloadStream(file.getObjectId()));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user