mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:26:51 +00:00
Merge pull request #2539 from hongwei1/refactor/glossaryFolder
refactor/update glossary file retrieval to use URLDecoder for proper …
This commit is contained in:
commit
b663d9b4b3
@ -3520,8 +3520,11 @@ object Glossary extends MdcLoggable {
|
||||
}
|
||||
|
||||
private def getListOfFiles(): List[File] = {
|
||||
val glossaryPath = new File(getClass.getResource("").toURI.toString.replaceFirst("target/.*", "").replace("file:", ""),
|
||||
"/src/main/resources/docs/glossary")
|
||||
import java.net.URLDecoder
|
||||
import java.nio.charset.StandardCharsets
|
||||
val resourceUrl = getClass.getClassLoader.getResource("docs/glossary")
|
||||
val resourcePath = URLDecoder.decode(resourceUrl.getPath, StandardCharsets.UTF_8.name())
|
||||
val glossaryPath = new File(resourcePath)
|
||||
logger.info(s"|---> Glossary path: $glossaryPath")
|
||||
|
||||
if (glossaryPath.exists && glossaryPath.isDirectory) {
|
||||
@ -3531,7 +3534,7 @@ object Glossary extends MdcLoggable {
|
||||
.filter(_.getName.endsWith(".md"))
|
||||
.toList
|
||||
} else {
|
||||
logger.error(s"Do not have any files under glossary path ($glossaryPath), please double check the folder: obp-api/src/main/resources/docs/glossary")
|
||||
logger.error(s"Do not have any files under glossary path ($glossaryPath), please double check the folder path: $glossaryPath")
|
||||
List.empty[File]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user