From e53b94e0c537cd27aa3b032e457f0b10c1307e5b Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Mon, 15 Jul 2019 18:11:01 +0200
Subject: [PATCH] OO-4146: fix the path to search the newest files of course
 elements

---
 .../services/vfs/manager/VFSRepositoryServiceImpl.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/olat/core/commons/services/vfs/manager/VFSRepositoryServiceImpl.java b/src/main/java/org/olat/core/commons/services/vfs/manager/VFSRepositoryServiceImpl.java
index f2b7c4bb02a..11a2db2ab36 100644
--- a/src/main/java/org/olat/core/commons/services/vfs/manager/VFSRepositoryServiceImpl.java
+++ b/src/main/java/org/olat/core/commons/services/vfs/manager/VFSRepositoryServiceImpl.java
@@ -284,12 +284,16 @@ public class VFSRepositoryServiceImpl implements VFSRepositoryService, GenericEv
 
 	@Override
 	public List<VFSMetadata> getNewest(VFSMetadata ancestorMetadata, int maxResults) {
-		return metadataDao.getNewest(ancestorMetadata.getRelativePath(), maxResults);
+		File file = toFile(ancestorMetadata);
+		String path = getRelativePath(file);
+		return metadataDao.getNewest(path, maxResults);
 	}
 
 	@Override
 	public List<VFSMetadata> getMostDownloaded(VFSMetadata ancestorMetadata, int maxResults) {
-		return metadataDao.getMostDownloaded(ancestorMetadata.getRelativePath(), maxResults);
+		File file = toFile(ancestorMetadata);
+		String path = getRelativePath(file);
+		return metadataDao.getMostDownloaded(path, maxResults);
 	}
 
 	/**
-- 
GitLab